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(); }
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; } }