Advertisement
Guest User

Untitled

a guest
Aug 5th, 2016
66
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.45 KB | None | 0 0
  1. public function doLogin($username,$password)
  2.     {
  3.         $hash = password_hash($password, PASSWORD_DEFAULT);
  4.         $stmt = $this->mysqli->prepare("SELECT id FROM utenti WHERE username = ? AND password = ? ");
  5.         $stmt->bind_param("ss",$username,$hash);
  6.         $stmt->execute();
  7.  
  8.         $stmt->bind_result($id);
  9.         $stmt->store_result();
  10.        
  11.         if($stmt->num_rows)
  12.         {
  13.             throw new Exception("Utente trovato");
  14.         }
  15.         throw new Exception("Utente o password errati!");
  16.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement