<?php
session_start();

// IMPORTANT: Replace with a secure way to store and check passwords, e.g., from a database.
$valid_username = 'admin';
$valid_password = 'password123'; // In a real application, this should be a hashed password.

if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    $username = $_POST['username'];
    $password = $_POST['password'];

    if ($username === $valid_username && $password === $valid_password) {
        $_SESSION['loggedin'] = true;
        $_SESSION['username'] = $username;
        header('Location: modern-dashboard.php');
        exit;
    } else {
        header('Location: login.php?error=Invalid credentials');
        exit;
    }
}
?>
