View file aut.php

File size: 1.04Kb
<?
include_once ('sys/index.php');
if(isset($user)) {header('Location: index.php?');exit;}
if (isset($_GET['login']) AND isset($_GET['pass']))
{
$q = mysql_query("SELECT `id` FROM `user` WHERE `name` = '".trim($_GET['login'])."' AND `pass` = '".trim($_GET['pass'])."' LIMIT 1");
	if (mysql_num_rows($q) != 0) {
	$_SESSION['uid'] =  mysql_result($q, 0);
	mysql_query("DELETE FROM `g` WHERE `iplong` = '$iplong' OR `sess` = '$sess' LIMIT 1");
 	header('Location: index.php');
	}
	else header('Location: ?err');
} 
else 
{
head('Авторизация');
if ( isset($_GET['err'])) msg('Ошибка авторизации!');
echo '<div class="ferma_menu">
<form action="?" method="get">
Логин:<br /><input name="login" type="text" /><br />
Пароль:<br /><input name="pass" type="password" /><br />
<input type="submit" value="Войти" /></form><br />
</div>
<div class=\'ferma_rekl\'>
&raquo; <a href=\'pass.php\'>Забыл пароль?</a><br/>
&laquo; <a href="/">На главную</a><br/>
</div>
';
}
foot();
?>