Guest User

Untitled

a guest
Feb 5th, 2019
58
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.62 KB | None | 0 0
  1. public function getUserByEmailAndPassword($email, $password) {
  2.  
  3.         $stmt = $this->conn->prepare("SELECT * FROM UZYTKOWNICY WHERE EMAIL = ?");
  4.  
  5.         $stmt->bind_param("s", $email);
  6.  
  7.         if ($stmt->execute()) {
  8.             $user = $stmt->get_result()->fetch_assoc();
  9.             $stmt->close();
  10.  
  11.             $salt = $user['SALT'];
  12.             $encrypted_password = $user['ENCRYPTED_PASSWORD'];
  13.             $hash = $this->checkhashSSHA($salt, $password);
  14.             if ($encrypted_password == $hash) {
  15.                 return $user;
  16.             }
  17.         } else {
  18.             return NULL;
  19.         }
  20.     }
Add Comment
Please, Sign In to add comment