View file pages/auth.php

File size: 1.29Kb
<?php 
// by mides, icq: 529-899-6, mail: [email protected]

$title = 'Вход';
require("../config.php");
require("../includes/start.php");
require("../includes/functions.php");

tp('Вход');

$login = sec($_REQUEST['l']);
$pass = md5(sec($_REQUEST['p']));

$correct_lp = mysql_result(mysql_query("SELECT COUNT(`id`) FROM `users` WHERE `user_login` = '$login' && `user_pass` = '$pass'"), 0);
if($correct_lp > 0){
	$user = mysql_fetch_assoc(mysql_query("SELECT `id`, `user_lastvisit`, `user_access` FROM `users` WHERE `user_login` = '$login' && `user_pass` = '$pass'"));
	$_SESSION['user_id'] = $user['id'];
	$_SESSION['login'] = $login;
	$_SESSION['access'] = $user['user_access'];
	mysql_query("UPDATE `users` SET `user_lastvisit` = '".time()."' WHERE `id` = '".$_SESSION['user_id']."'"); // обновим для след. показа
	echo '<div class="s1">Информация</div><div class="s2">'.$_SESSION['login'].', добро пожаловать на наш сайт!<br/>';
	echo 'Ваш последний визит: '.date('d.m.Y / H:i', $user['user_lastvisit']).'<br/>';
	echo '<a href="../?">&lt;--</a>';
	echo '</div>';
	echo '</div>';
	nav();
}else{
	error('Вы ввели неверный логин или пароль!');
	nav();
}

require("../includes/tail.php");
?>