prepare("SELECT id, password FROM users WHERE username = ?"); $stmt->execute([$username]); $user = $stmt->fetch(); if ($user && password_verify($password, $user['password'])) { $_SESSION['user_id'] = $user['id']; $_SESSION['username'] = $username; header("Location: chat.php"); exit; } else { $error = 'Invalid username or password.'; } } } require_once 'includes/header.php'; ?>

Login

Don't have an account? Register here