Example #1
0
 private function DeleteCookie()
 {
     if (isset($_COOKIE[$this->cookie_name])) {
         $signup = new SignUp();
         $signup->SetCookie("login", array("username" => "", "hash" => ""), time() - 3600, $_SERVER['SERVER_NAME']);
     }
 }
Example #2
0
 public function CheckLogin()
 {
     try {
         $sth = DB::prep("\r\n                SELECT id,username,pass,`group`\r\n                FROM messaging_admin\r\n                WHERE username = :user AND pass = sha1(:pass)");
         $sth->bindParam(":user", $this->user, PDO::PARAM_STR);
         $sth->bindParam(":pass", $this->pass, PDO::PARAM_STR);
         $result = DB::getFirst($sth, null, PDO::FETCH_OBJ);
         if (!empty($result)) {
             $signup = new SignUp();
             $signup->SetCookieName($this->cookie_name);
             $signup->SetSession(array("userid" => $result->id, "username" => $result->username, "group" => $result->group));
             if ($this->remember == 1) {
                 $signup->SetCookie("login", array("username" => $result->username, "hash" => $result->pass), 31556926, $_SERVER['SERVER_NAME']);
                 $signup->SignUp();
             }
             $this->success = true;
         } else {
             $this->failed = true;
         }
     } catch (Exception $e) {
         die($e->getMessage());
     }
 }