예제 #1
0
 public function delete_session()
 {
     $user_id = (int) $_COOKIE['user_id'];
     $this->prepare("DELETE FROM sessions WHERE user_id=:id");
     $this->query->bindParam(':id', $user_id, PDO::PARAM_INT);
     $this->execute_simple();
     Authorization::delete_cookie();
 }
예제 #2
0
파일: model_login.php 프로젝트: RhmBWT/WofT
 function approveUser($login, $pass)
 {
     if ($this->checkPass($pass, $login)) {
         #ПРОВЕРЯЕМ ПРАВИЛЬНОСТЬ ПАРОЛЯ
         $time = time() + TIME;
         var_dump($time);
         $this->hash = md5($this->generateCode(10));
         $this->prepare("INSERT INTO sessions SET user_id=:id, s_hash=:hash,s_time=:time");
         $this->query->bindParam(':hash', $this->hash);
         $this->query->bindParam(':id', $this->thisUser['id']);
         $this->query->bindParam(':time', $time);
         // Два часа!
         $this->execute_simple();
         $this->createCookie();
         // Создаем куки
         return true;
     } else {
         Authorization::delete_cookie();
         return false;
     }
 }