Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- session_start();
- ?>
- <!DOCTYPE html>
- <html>
- <head>
- <style>
- table, th, td {
- border: 1px solid black;
- }
- </style>
- </head>
- <body>
- <?php
- unset($_SESSION['Error']);
- unset($_SESSION['Welcome']);
- $username = filter_input(INPUT_POST,'username');
- $usernameF = $username;
- $username = strtolower($username);
- $password = filter_input(INPUT_POST,'password');
- $servername = "localhost";
- $dbusername = "root";
- $dbpassword = "";
- $dbname = "gamingbuddy";
- // Create connection
- $conn = new mysqli($servername, $dbusername, $dbpassword, $dbname);
- // Check connection
- if ($conn->connect_error) {
- die("Connection failed: " . $conn->connect_error);
- }
- $sql = "SELECT password FROM gb_account WHERE gb_Account.Username LIKE '$username'";
- $result = $conn->query($sql);
- echo "<p>". $password . "</p>";
- if ($result->num_rows > 0) {
- while($row = $result->fetch_assoc()) {
- echo "<p>" . $row["password"] . "</p>";
- if(password_verify($password,$row["password"])){
- $_SESSION["Welcome"] = "Welkom ".$usernameF;
- }
- else{
- $_SESSION["Error"] = "De gebruikersnaam/wachtwoord combinatie is ongeldig.";
- }
- }
- }
- else {
- $_SESSION["Error"] = "De gebruikersnaam/wachtwoord combinatie is ongeldig.";
- }
- $conn->close();
- header("Location: index.php");
- exit;
- ?>
- </body>
- </html>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement