Changed login.php so you dont have to use username to log-in anymore only Email and Password
This commit is contained in:
		@@ -4,13 +4,13 @@ require_once 'config.php';
 | 
				
			|||||||
 | 
					
 | 
				
			||||||
if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
					if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
				
			||||||
    // Handle login form submission
 | 
					    // Handle login form submission
 | 
				
			||||||
    $username = $_POST['username'];
 | 
					    $email = $_POST['email'];
 | 
				
			||||||
    $password = $_POST['password'];
 | 
					    $password = $_POST['password'];
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Prepare and execute the SQL query using prepared statements
 | 
					    // 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 = $mysqli->prepare($query);
 | 
				
			||||||
    $stmt->bind_param("s", $username);
 | 
					    $stmt->bind_param("s", $email);
 | 
				
			||||||
    $stmt->execute();
 | 
					    $stmt->execute();
 | 
				
			||||||
    $stmt->bind_result($user_id, $user_username, $user_password, $user_isAdmin);
 | 
					    $stmt->bind_result($user_id, $user_username, $user_password, $user_isAdmin);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
@@ -20,7 +20,7 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
				
			|||||||
        header('Location: index.php');
 | 
					        header('Location: index.php');
 | 
				
			||||||
        exit();
 | 
					        exit();
 | 
				
			||||||
    } else {
 | 
					    } else {
 | 
				
			||||||
        echo "Invalid username or password.";
 | 
					        echo "Invalid email or password.";
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
 | 
					
 | 
				
			||||||
    // Close the statement
 | 
					    // Close the statement
 | 
				
			||||||
 
 | 
				
			|||||||
		Reference in New Issue
	
	Block a user