Advertisement
Guest User

Untitled

a guest
May 24th, 2018
104
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.91 KB | None | 0 0
  1. <!DOCTYPE html>
  2. <html lang="en">
  3. <head>
  4.   <title>Login</title>
  5. </head>
  6. <body>
  7.   <form action="menu.php" method="POST">
  8.   Username: <input type="text" name="user" id="user"><br>
  9.   Password: <input type="text" name="passwd" id ="passwd"><br>
  10.   <input type="submit">
  11.   </form>
  12.  
  13.   <?php
  14.     session_start();
  15.     include_once "connection.php";
  16.     $hash = "SELECT passwd FROM users WHERE username = \"$username\"";
  17.  
  18.     /* $sql = "SELECT * FROM users WHERE username=\"$username\" AND passwd=\"$pass_word\";
  19.     if(mysqli_query($conn, $sql)){
  20.         header('Location:session.php');
  21.     } else{
  22.         echo "Gebruikersnaam en/of wachtwoord niet correct.";
  23.     } */
  24.  
  25.  
  26. if (password_verify('passwd', $hash)) {
  27.     // valid, proceed to login
  28.     $_SESSION['user'] = $_POST['user'];
  29.     header( "Location: session.php" );
  30. } else {
  31.     echo "Gebruikersnaam en/of wachtwoord onjuist.";
  32.   }
  33.   ?>
  34. </body>
  35. </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement