<?
if(isset($_POST['nick']) && isset($_POST['password'])){
$auth_id = mysql_fetch_assoc(mysql_querll('SELECT `id`,`search_accelerator`,`autologin` FROM `kolhoz_user` WHERE `nick`="'.my_esc($_POST['nick']).'" AND `password`="'.md5(my_esc($_POST['password'])).'" LIMIT 1'));
if($auth_id['id']==''){
err_game("Неверный ник или пароль");
} else {
/*
if(isset($_POST['aut_save']) && $_POST['aut_save']==1){
setcookie('id_user', $user ['id'], time()+60*60*24*365);
setcookie('pass', cookie_encrypt($_POST ['password'],$user ['id']), time ()+60*60*24*365);
}
*/
$_SESSION['id_user'] = $auth_id['id'];
$_SESSION['search_accelerator'] = $auth_id['search_accelerator'];
if(!empty($_GET['r'])){$_SESSION['refer'] = intval($_GET['r']);}
if($_POST['auth_auto']==1){setcookie('autologin',$auth_id['autologin'],$time+31536000);}
header('Location:?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>
<input type="checkbox" name="auth_auto" value="1"> Оставаться в системе?
<li class="pt">
<input type="submit" value="Войти">
</li>
</ul>
</form>
<ul>
<li><img width="16" height="16" src="img/icons/reg.png" alt="*">
<a href="?regi">Регистрация</a></li>

<li><img width="16" height="16" src="img/icons/rename.png" alt="*">
<a href="?pass">Восстановление пароля</a>
</li>
</ul>
</div>
</div>
<div class="block event">
<img width="16" height="16" src="img/icons/back.png" alt="o"> <a href="/">В начало</a>
</div>
</div>
<?
echo "<div class='block event'>";
echo "Онлайн <span class='title'>".mysql_result(mysql_querll("SELECT COUNT(`id`) FROM `kolhoz_user` WHERE `date_last` > '".(time()-600)."'"), 0)."</span>, регистраций
<span class='title'>".mysql_result(mysql_querll("SELECT COUNT(`id`) FROM `kolhoz_user`"), 0)."</span></div>";
echo "</div>";
exit;
?>