Файл: enter.php
Строк: 16
<?
define('PROTECTOR', 1);
//session_start();
if(!empty($_POST['log'])){
$log = htmlspecialchars(stripslashes(addslashes($_POST['log'])));
$pass = htmlspecialchars(stripslashes(addslashes($_POST['pas'])));}
if(!empty($_GET['login'])){
$log = htmlspecialchars(stripslashes(addslashes($_GET['login'])));
$pass = htmlspecialchars(stripslashes(addslashes($_GET['pas'])));}
/////////////////////////////////////////////////////
require_once ('files/db.php');//подключаем бд
/////////////////////
$pas=md5($pass);
$req = mysql_query("SELECT * FROM `users` WHERE `usr` = '$log' and `pass`='$pas' LIMIT 1");
////////////////////////////
$udata = mysql_fetch_array($req);
$avto=mysql_num_rows($req);
$set = mysql_query("SELECT * FROM `set` WHERE `usr` = '$log'LIMIT 1");
$set=mysql_num_rows($set);
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
////////////////////////////////////////////////////////
if ($avto==1 and $log==$udata[usr]){
if ($_POST['mem'] == 1) {
// Установка данных COOKIE
$clog = base64_encode($log);
$cpas = $pas;
setcookie("log", $clog, time() + 3600 * 24 * 365);
setcookie("pas", $cpas, time() + 3600 * 24 * 365);
}else{
$clog = base64_encode($log);
$cpas = $pas;
setcookie("log", $clog, time() + 3600 * 24 );
setcookie("pas", $cpas, time() + 3600 * 24 );
}
$_SESSION['log'] = $log;
$_SESSION['pas'] = $pas;
$_SESSION['pass'] = $pass;
if(isset($_SESSION['log'])){
header ("Location: index.php?cookie");
}
}else {
header ("Location: index.php?error");
exit; }
?>