Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public function authorize($username, $password, $remember=false)
- {
- $query = "select id, username from users where
- username = :username and password = :password limit 1";
- $sth = $this->db->prepare($query);
- $salt = $this->getSalt($username);
- if (!$salt) {
- return false;
- }
- $hashes = $this->passwordHash($password, $salt);
- $sth->execute(
- array(
- ":username" => $username,
- ":password" => $hashes['hash'],
- )
- );
- $this->user = $sth->fetch();
- if (!$this->user) {
- $this->is_authorized = false;
- } else {
- $this->is_authorized = true;
- $this->user_id = $this->user['id'];
- $this->saveSession($remember);
- }
- return $this->is_authorized;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement