Advertisement
Guest User

Untitled

a guest
Jun 5th, 2017
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.66 KB | None | 0 0
  1. <?php
  2. session_start();
  3.  
  4. if ($_SERVER['REQUEST_METHOD'] == 'GET')
  5. {
  6. session_destroy();
  7. header("location: ../public/resultateninvoer.php");
  8. }
  9.  
  10. require_once("database.php");
  11. $username = $_POST["username"];
  12. $password = $_POST["password"];
  13.  
  14. $sql = "SELECT * FROM `tbl_users`
  15. WHERE `username` = '$username';";
  16. $user = $database->query($sql)->fetch(PDO::FETCH_ASSOC);
  17.  
  18. if (password_verify($password, $user["password"]))
  19. {
  20. $_SESSION["logged"] = true;
  21. $_SESSION["user"] = $username;
  22.  
  23. header("location: ../public/todolist.php");
  24. }
  25. else
  26. {
  27. $_SESSION["logged"] = false;
  28.  
  29. header("location: ../public/resultateninvoer.php");
  30. }
  31. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement