Файл: DARK WARS/index.php
Строк: 63
<?php
if (isset($_GET['r'])) {
$_SESSION['ref'] = (int)$_GET['r'];
}
include_once 'fnc.php';
if (isset($_POST['nick']) && isset($_POST['pass']))
{
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `nick` = '".mysql_real_escape_string($_POST['nick'])."' AND `pass` = '".shif($_POST['pass'])."' LIMIT 1"), 0)==1) {
$user=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `nick` = '".mysql_real_escape_string($_POST['nick'])."' AND `pass` = '".shif($_POST['pass'])."' LIMIT 1"));
$_SESSION['id_user']=$user['id'];
setcookie('id_user', $user['id'], time()+60*60*24*365);
setcookie('pass', cookie_encrypt($_POST['pass'],$user['id']), time()+60*60*24*365);
mysql_query("UPDATE `user` SET `date_aut` = ".time()." WHERE `id` = '$user[id]' LIMIT 1");
mysql_query("UPDATE `user` SET `date_last` = ".time()." WHERE `id` = '$user[id]' LIMIT 1");
}
else echo 'Неправильный логин или пароль';
}
if (isset($_SESSION['id_user']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = $_SESSION[id_user] LIMIT 1"), 0)==1)
{
$user=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$_SESSION['id_user']."' LIMIT 1"));
} elseif (isset($_COOKIE['id_user']) && isset($_COOKIE['pass']) && $_COOKIE['id_user']!=NULL && $_COOKIE['pass']!=NULL) {
if (mysql_result(mysql_query("SELECT COUNT(*) FROM `user` WHERE `id` = ".intval($_COOKIE['id_user'])." AND `pass` = '".shif(cookie_decrypt($_COOKIE['pass'],intval($_COOKIE['id_user'])))."' LIMIT 1"), 0)==1)
{
$user=mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = '".$_COOKIE['id_user']."' LIMIT 1"));
$_SESSION['id_user']=$user['id'];
mysql_query("UPDATE `user` SET `data_aut` = ".time().", `date_last` = ".time()." WHERE `id` = '$user[id]' LIMIT 1");
}
}
if ($user) {
header ("Location: /dark_war/");
exit;
}
?>
<!DOCTYPE html PUBLIC "-//WAPFORUM//DTD XHTML Mobile 1.0//EN" "http://www.wapforum.org/DTD/xhtml-mobile10.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="ru">
<head>
<title>Авторизация</title>
<link rel="shortcut icon" href="/style/shield.ico" />
<link rel="stylesheet" type="text/css" href="/dark_war/style/style.css" />
<link rel="stylesheet" type="text/css" href="/dark_war/style/originalstyle.css" />
<meta http-equiv="content-Type" content="application/xhtml+xml; charset=utf-8" />
</head>
<body>
<?php
echo "<div class='logotip'><img src='/img/logo.png' alt='' /></div>";
echo "<div class='div1'>";
echo "<center><img src='/dark_war/all_img/logo.png' alt='' /></center>";
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_online_us`"), 0);
$count1 = mysql_result(mysql_query("SELECT COUNT(*) FROM `dark_war_users`"), 0);
echo "<br /><center>";
echo "В данный момент в игре игроков - <b>$count</b> <br />";
echo "Всего игроков - <b>$count1</b> <br />";
echo "Регестрируйся будешь - <b>".($count1 + 1)."-й</b> ";
echo "<div class='daty'>";
echo "<form method='post' action=''>";
echo "</div>"; echo "</div>";
echo "<div class='div2'>";
echo "<center><div class='input_login'>";
echo "Ник для входа: <br /><input class='input_log' type='text' name='nick'/><br />";
echo "</div>";
echo "<div class='input_login'>";
echo "Пароль: <br /><input class='input_log' type='text' name='pass'/><br />";
echo "</div>";
echo "<input type='submit' name='save' value='Войти в аккаунт'>";
echo "<div class='ac'>";
echo " У вас ещё нет аккаунта? Тогда пройдите быструю <a href='/registration.php'><span><br />РЕГИСТРАЦИЮ</span></a> и присоеденяйтесь к остальным <b>$count1</b> игрокам, из которых <b>$count</b> сейчас онлайн!<br /><br /></center>";
echo "</div>";
echo "</form>";
echo "</div>";echo "</center>";
echo "</center>";
echo "</div>";
?>
</body>
</html>