"skús to commitnúť, počkaj toto ../ dám ešte preč aby to nevypadalo tak..."
This commit is contained in:
		@@ -8,15 +8,18 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
			
		||||
    $password = $_POST['password'];
 | 
			
		||||
 | 
			
		||||
    // Validate login credentials and fetch user details
 | 
			
		||||
    $query = "SELECT id, username, password, isAdmin FROM users WHERE email = ?";
 | 
			
		||||
    $query = "SELECT id, username, password, email, isAdmin FROM users WHERE email = ?";
 | 
			
		||||
    $stmt = $mysqli->prepare($query);
 | 
			
		||||
    $stmt->bind_param("s", $email);
 | 
			
		||||
    $stmt->execute();
 | 
			
		||||
    $stmt->bind_result($user_id, $user_username, $user_password, $user_isAdmin);
 | 
			
		||||
    $stmt->bind_result($user_id, $user_username, $user_password, $user_email, $user_isAdmin);
 | 
			
		||||
 | 
			
		||||
    // Fetch the result
 | 
			
		||||
    if ($stmt->fetch() && password_verify($password, $user_password)) {
 | 
			
		||||
        $_SESSION['user_id'] = $user_id;
 | 
			
		||||
        $_SESSION['user_username'] = $user_username;
 | 
			
		||||
        $_SESSION['user_email'] = $user_email;
 | 
			
		||||
        $_SESSION['user_isAdmin'] = $user_isAdmin;
 | 
			
		||||
 | 
			
		||||
        // Redirect to the main domain after successful login
 | 
			
		||||
        header('Location: http://watch.twip-network.org');
 | 
			
		||||
@@ -28,5 +31,4 @@ if ($_SERVER["REQUEST_METHOD"] == "POST") {
 | 
			
		||||
    // Close the statement
 | 
			
		||||
    $stmt->close();
 | 
			
		||||
}
 | 
			
		||||
include "pages/login.html";
 | 
			
		||||
?>
 | 
			
		||||
 
 | 
			
		||||
		Reference in New Issue
	
	Block a user