- 1
- 2
- 3
- 4
- 5
- 6
- 7
- 8
- 9
- 10
- 11
- 12
- 13
- 14
- 15
- 16
- 17
- 18
private function checkCookie(){
if(!isset($_COOKIE['sessid'])) {
$this->userInfo['id'] = 0;
$this->userInfo['isAdmin'] = false;
return false;
}
$id_lenght = strlen($_COOKIE['sessid']) - 32;
$cookie_id = substr($_COOKIE['sessid'],0,$id_lenght);
$cookie_hash = substr($_COOKIE['sessid'],$id_lenght);
$this->registry['db']->heal($cookie_id); // антиинжект
$dbres = $this->registry['db']->query("SELECT password FROM users WHERE user_id = '$cookie_id';")->fetch();
if(md5($dbres['password']) == $cookie_hash){
$this->userInfo['id'] = $cookie_id;
return true;
}
return false;
}
Комментарии (2) RSS