<?php
session_start();
$adminToken = getenv('ADMIN_TOKEN') ?: null;
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$pw = $_POST['password'] ?? '';
if ($adminToken && hash_equals($adminToken, $pw)) {
$_SESSION['is_admin'] = true;
header('Location: index.php');
exit;
}
}
?>
<!doctype html>
<html><head><meta charset="utf-8"><title>admin login</title></head><body>
<form method="post">
<label>password: <input type="password" name="password" autofocus></label>
<button type="submit">login</button>
</form>
</body></html>