<?php
session_start();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if ($_POST['username'] === 'admin' && $_POST['password'] === 'pass123') {
        $_SESSION['admin'] = true;
        header('Location: dashboard.php');
        exit();
    }
    $error = "Invalid login!";
}
?>

<form method="post">
  <h2>Admin Login</h2>
  <?php if (!empty($error)) echo "<p>$error</p>"; ?>
  <input type="text" name="username" placeholder="Username" required><br/>
  <input type="password" name="password" placeholder="Password" required><br/>
  <button type="submit">Login</button>
</form>

