Advertisement
Guest User

Untitled

a guest
Jun 11th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.83 KB | None | 0 0
  1. if(isset($_POST["login"])){
  2. $username = $_POST["username"];
  3. $password = $_POST["password"];
  4. $password_hashed = password_hash($password,PASSWORD_DEFAULT);
  5. $SQL = "SELECT `username`, `password` FROM `users` WHERE `username` = ?";
  6. if($stmt = $conn->prepare($SQL)){
  7. $stmt->bind_param("s", $username);
  8. $stmt->bind_result($username, $password_hashed);
  9. if($stmt->execute()){
  10. $stmt->store_result();
  11. if($stmt->num_rows == 1){
  12. $stmt->fetch();
  13. if(password_verify($password, $password_hashed)){
  14. echo "U bent nu ingelogd.";
  15. } else {
  16. echo "Inloggen mislukt.";
  17. }
  18. }
  19.  
  20. }
  21. }
  22. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement