<?php
session_start();
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
    if (isset($_POST['code']) && $_POST['code'] === 'HZ2025') {
        $_SESSION['guest_ok'] = true;
        header('Location: index.php'); exit;
    } else {
        $error = 'Ungültiger Code';
    }
}
?>
<!DOCTYPE html>
<html lang="de">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <title>Login</title>
    <link rel="stylesheet" href="css/style.css">
</head>
<body>
<div class="login-container">
    <h1>Gästecode eingeben</h1>
    <?php if ($error): ?><p class="error"><?= htmlspecialchars($error, ENT_QUOTES | ENT_HTML5, 'UTF-8') ?></p><?php endif; ?>
    <form method="post">
        <input type="text" name="code" placeholder="Code" required>
        <button type="submit">Loslegen</button>
    </form>
</div>
</body>
</html>