public function Check() { try { $sth = DB::prep("\r\n SELECT id, username, pass, `group`\r\n FROM messaging_admin\r\n WHERE username = :user AND pass = :pass"); $sth->bindParam(":user", $this->username, PDO::PARAM_STR); $sth->bindParam(":pass", $this->hash, PDO::PARAM_STR); $result = DB::getFirst($sth, null, PDO::FETCH_OBJ); if (!empty($result)) { $signup = new SignUp(); $signup->SetSession(array("userid" => $result->id, "group" => $result->group, "username" => $result->username)); } } catch (Exception $e) { die($e->getMessage()); } }
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()); } }