<?



if(isset($_POST['nick']) && isset($_POST['password']))
{
include_once 'inc/head.php'; 

if(mysql_result(mysql_query("SELECT COUNT(*) FROM `kolhoz_user` WHERE `nick` = '".my_esc($_POST['nick'])."' AND `password` = '".md5(my_esc($_POST['password']))."' LIMIT 1"),0)==0)err_game("Неверный ник или пароль");
else
{
$user =mysql_fetch_array(mysql_query("SELECT * FROM `kolhoz_user` WHERE `nick` = '".my_esc($_POST['nick'])."' AND `password` = '".md5($_POST['password'])."'"));
$id=$user['id'];
$pass = md5($_POST['password']);
    
setcookie('id', $id, time() + 84600 * 365, '/');
setcookie('pass', $pass, time() + 84600 * 365, '/');

header("Location: http://$_SERVER[HTTP_HOST]/myfarm");
exit;
}
}
?>
<div class="event">
<div><h1>Вход</h1></div>
</div>
<div class="content">
<div class="block">
<form method="post"><ul>
<li>
<label>Ник:<br>
<input type="text" value="" name="nick">
</label>
</li>
<li class="pt">
<label>Пароль:<br>
<input type="password" value="" name="password">
</label>
</li> 
<li class="pt">
<input type="submit" value="Войти">
</li>
</ul>
</form>
<div class="pt">
<ul>
<li><img width="16" height="16" src="images/icons/rename.png" alt="*">
<a href="/pass">Восстановление пароля</a></li>
</ul>
</div>
</div>
<div class="block event">
<img width="16" height="16" src="images/icons/back.png" alt="o"> <a href="/">В начало</a>
</div>
</div>
<?
echo'</div></div></div></div></div></div></div></div></div></div>';

include_once 'inc/foot.php';
exit;
?>