if isset _COOKIE login isset _COOKIE pass login check _COOKIE login pa

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
if(isset($_COOKIE['login']) && isset($_COOKIE['pass'])){
$login = check($_COOKIE['login']);
$password = check($_COOKIE['pass']);
$pass = md5(md5($password));
if(empty($login) or empty($pass)){
setcookie('login', '', time()-cookie_time, '/');
setcookie('pass', '', time()-cookie_time, '/');
}
$user = $db->prepare("SELECT * FROM `users` WHERE `login`= '$login' AND `pass`= '$pass' LIMIT 1"smile;
$user->execute();
$userid = $user->fetch(PDO::FETCH_ASSOC);
if(isset($userid['id'])){
if($userid['login']!=$login or $userid['pass']!=$pass){
setcookie('login', '', time()-cookie_time, '/');
setcookie('pass', '', time()-cookie_time, '/');
}}}