Файл: modules/check.php
Строк: 17
<?
include_once "../inc/bd.php";
if($_GET['userpanel'] == 'logout')
{
$userid = $_COOKIE['id'];
$ps = mysql_query("UPDATE users SET hash='' WHERE `id`='$userid'", $db) or die(mysql_error());
if($ps) {
setcookie("id",$userid,time()-3600,"/");
setcookie("hash",$userid,time()-3600,"/");
Header("Location: /index.php");
}
}
if(isset($_POST['login']) and isset($_POST['pass']))
{
$login = $_POST['login'];
$pass = md5(md5($_POST['pass']));
$ps = mysql_query("SELECT id,hash FROM users WHERE login='$login' and pass='$pass'",$db);
if($ps)
{
$user = mysql_fetch_array($ps);
$userid = $user['id'];
$userhash = md5(rand(1,255) * 9);
mysql_query("UPDATE users SET hash='$userhash' WHERE id='$userid'");
if(!isset($_POST[zap])) {
setcookie("id",$userid,0,"/");
setcookie("hash",$userhash,0,"/");
} else {
setcookie("id",$userid,time()+3600,"/");
setcookie("hash",$userhash,time()+3600,"/");
}
}
Header("Location: /index.php");
}
?>