File size: 1.76Kb
<?
if (!defined('SECURED'))
{
die("Unknown Error!");
}
include'includes/func_gensid.php';
title('Авторизация');
div('Авторизация','b');
if(!empty($_POST['login']) && !empty($_POST['pass']))
{
$login=val($_POST['login']);
$pass=val($_POST['pass']);
list($uid)=mysql_fetch_array(mysql_query("select id from users where login='".$login."' and pass='".$pass."';"));
if(mysql_affected_rows()==0) $error='Неверный логин или пароль!';
if(!empty($error))
{
echo div($error,'c');
}
else
{
$session=generate_sid();
$_SESSION['s_sid']=$session;
mysql_query("update users set session='$session', ver='$ver' where id='$uid';");
echo'Авторизация прошла успешно!<br/>
<a href="'.$_SERVER['PHP_SELF'].'?sid='.$session.'&'.SID.'">Войти</a><br/>';
footer();
exit;
}
}
if($ver=='wml')
{
echo 'Логин:<br/>';
echo '</small><input name="login'.$rand.'" type="text" value="" maxlength="20"/><br/>';
echo '<small>Пароль:<br/>';
echo '</small><input name="pass'.$rand.'" type="password" value="" maxlength="20"/><br/>';
echo'<small><anchor>OK<go href="'.$_SERVER['PHP_SELF'].'?mode=auth&'.SID.'" method="post">';
echo'<postfield name="login" value="$(login'.$rand.')"/>';
echo'<postfield name="pass" value="$(pass'.$rand.')"/>';
echo'</go></anchor><br/>';
}
else
{
echo '<form action="'.$_SERVER['PHP_SELF'].'?mode=auth&'.SID.'" method="post">';
echo 'Логин:<br/>';
echo '<input name="login" type="text" value="" maxlength="40"/><br/>';
echo 'Пароль:<br/>';
echo '<input name="pass" type="password" value="" maxlength="40"/><br/>';
echo '<input type="submit" value="OK"/></form>';
}
echo $separator;
echo $goback;
?>