Файл: accmarket.net/input.php
Строк: 28
<?
define('_ON_CMS', 1);
$rootpath = '';
require_once 'includes/start.php';
require_once 'includes/function.php';
if($_POST or $_GET)
{
if($_POST)
{
$login = isset($_POST['login']) ? check(trim($_POST['login'])): false;
$password = isset($_POST['password']) ? check(trim($_POST['password'])) : false;
}
else
{
$login = isset($_GET['login']) ? check(trim($_GET['login'])): false;
$password = isset($_GET['password']) ? check(trim($_GET['password'])) : false;
}
$error = false;
if (empty($login) or empty($password))
$errors = 'Авторизация провалена! Введите логин и пароль!';
if(empty($errors))
{
$pass = md5(md5($password));
$req = mysql_query("SELECT * FROM `users` WHERE `login`='" . $login . "' AND `password`='" . $pass . "' LIMIT 1");
if (mysql_num_rows($req) == 0)
$errors = 'Авторизация провалена! Логин и пароль не верны!';
else
$res = mysql_fetch_array($req);
}
if(empty($errors))
{
$use_id = $res['id'];
if ($_POST['memory'] == 1)
{
$cuid = base64_encode($use_id);
$cups = md5($password);
setcookie("uid", $cuid, time() + 3600 * 24 * 14);
setcookie("pass", $cups, time() + 3600 * 24 * 14);
}
// Установка данных сессии
$_SESSION['uid'] = $use_id;
$_SESSION['pass'] = $pass;
mysql_query("UPDATE `users` SET `lasttime`=" . time() . " WHERE `id` = '" . $use_id . "'");
header("Location: /game.php");
div('<a href="'.$home.'/">Вход</a>','conts');
}
else
{
require_once 'includes/header.php';
div('<strong>ОШИБКА!</strong><br />' . $errors,'conts');
div('<a href="index.php">Назад</a>','conts');
}
}
?>