Advertisement
Guest User

Untitled

a guest
Feb 11th, 2016
70
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.63 KB | None | 0 0
  1. $username = $_POST["username"];
  2. $password = $_POST["password"];
  3.  
  4. $result = $conn->query("SELECT * FROM User WHERE username ='$username'");
  5.  
  6. if(empty($result)){
  7. die("Username doesn't exist");
  8. }
  9.  
  10. $dbpass = $conn->query("SELECT password FROM User WHERE username = '$username'");
  11.  
  12. if (password_verify($password, $dbpass)){
  13.  
  14. $stmt = "SELECT * FROM User WHERE username='$username' and password='$password'";
  15.  
  16. $check = mysqli_fetch_array(mysqli_query($conn, $stmt));
  17.  
  18. if(isset($check)){
  19. echo "success";
  20. }else{
  21. echo "Invalid Username or Password";
  22. }
  23. }
  24. else {
  25. echo "password not unhashing";
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement