Advertisement
Guest User

Untitled

a guest
Sep 18th, 2017
72
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.84 KB | None | 0 0
  1. if (isset($_POST['submit'])){
  2. $username = $_POST['username'];
  3. $password = $_POST['password'];
  4. $q = $handler->prepare('SELECT * FROM users WHERE username = ?');
  5. $result = $q->execute(array($username));
  6.  
  7. if ($q->rowCount() > 0){
  8. $result = $q -> fetch(PDO::FETCH_ASSOC);
  9. $hash_pwd = $result['password'];
  10. $hash = password_verify($password, $hash_pwd);
  11.  
  12. if ($hash == 0) {
  13. error_log("hashwrong");
  14. echo '<p class="error-message3">'.'<br>'.'<br>'."You have ented an incorrect login! <br>Please try again.".'</p>';
  15. }
  16. else {
  17. $_SESSION['username'] = $username;
  18. error_log("loggedin");
  19. header("location: index.php");return;
  20. }
  21. }
  22. }
  23. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement