Advertisement
Guest User

Untitled

a guest
Mar 12th, 2019
121
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.69 KB | None | 0 0
  1. <?php
  2. include_once 'assets\config\database.php';
  3. include_once 'assets\resource\session.php';
  4. include_once 'assets\resource\utilities.php';
  5.  
  6. if (isset($_POST['loginBtn'])) {
  7.  
  8. $user = $_POST['username'];
  9. $password = $_POST['password'];
  10.  
  11. $sqlQuery = "SELECT * FROM users WHERE username = :username"
  12. $statement = $db->prepare($sqlQuery);
  13. $statement->execute(array('username' => $user));
  14.  
  15. while($row = $statement->fetch()){
  16. $id = $row['id'];
  17. $hashed_password = $row['password'];
  18. $username = $row['username']
  19.  
  20. if(password_verify($password, $hashed_password)){
  21. $_SESSION['id'] = $id;
  22. $_SESSION['username'] = $username;
  23. header('Location: dashboard.php')
  24. }
  25. }
  26.  
  27. }
  28.  
  29. ?>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement