- 01
- 02
- 03
- 04
- 05
- 06
- 07
- 08
- 09
- 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;
}
guest 28.09.2013 02:14 # 0
2_71828182846 24.08.2021 20:38 # 0