From 607c307dc5d94bcc02c9bfc4efcd7bded6a570ca Mon Sep 17 00:00:00 2001 From: AkisYTB3 Date: Sat, 20 Jan 2024 17:01:33 +0100 Subject: [PATCH] Changed login.php so you dont have to use username to log-in anymore only Email and Password --- login.php | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/login.php b/login.php index 3013ce1..70aa0b3 100644 --- a/login.php +++ b/login.php @@ -4,13 +4,13 @@ require_once 'config.php'; if ($_SERVER["REQUEST_METHOD"] == "POST") { // Handle login form submission - $username = $_POST['username']; + $email = $_POST['email']; $password = $_POST['password']; // Prepare and execute the SQL query using prepared statements - $query = "SELECT id, username, password, isAdmin FROM users WHERE username = ?"; + $query = "SELECT id, username, password, isAdmin FROM users WHERE email = ?"; $stmt = $mysqli->prepare($query); - $stmt->bind_param("s", $username); + $stmt->bind_param("s", $email); $stmt->execute(); $stmt->bind_result($user_id, $user_username, $user_password, $user_isAdmin); @@ -20,7 +20,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") { header('Location: index.php'); exit(); } else { - echo "Invalid username or password."; + echo "Invalid email or password."; } // Close the statement