Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_set_cookie_params(900);
- session_start();
- ?>
- <!DOCTYPE html>
- <html lang="en">
- <head>
- <title>Login</title>
- </head>
- <body>
- <form method="POST">
- Username: <input type="text" name="user" id="user"><br>
- Password: <input type="password" name="passwd" id ="passwd"><br>
- <input type="submit">
- </form>
- <?php
- include_once "connection.php";
- $username = mysqli_real_escape_string($conn, $_POST['user']);
- $password = mysql_real_escape_string($conn, $_POST['passwd']);
- $hash = "SELECT passwd FROM users WHERE username = $username ";
- if (password_verify($password, $hash)) {
- // valid, proceed to login
- $_SESSION['user'] = $_POST[$username];
- header( "Location: session.php" );
- exit;
- } else {
- echo "Gebruikersnaam en/of wachtwoord onjuist.";
- exit;
- }
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement