View file a.php

File size: 839B
<?php 
// by mides, wmclub.mobi

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

if(empty($_REQUEST['l']) and empty($_REQUEST['p'])){
	$login = check($_POST['login']);
	$pass = md5(md5(check($_POST['pass'])));
}else{
	$login = check($_REQUEST['l']);
	$pass = md5(md5(check($_REQUEST['p'])));
}

$query = mysql_query("SELECT `user_login` FROM `users` WHERE `user_login` = '$login' and `user_pass` = '$pass' LIMIT 1");
if($query){	
	setcookie('login', $login, time()+86400*31);
	setcookie('pass', $pass, time()+86400*31);
	mysql_query("UPDATE `users` SET `user_lastvisit` = '".time()."' WHERE `user_login` = '$login'") or die(mysql_error());
	header('location: ./');
}else{
	header('location: pages/login.php'); exit();
}

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