- Move all admin dashboard and login rules into styles.css - Remove embedded <style> blocks from admin/login.php and admin/index.php - Clean up redundant preview action button
57 lines
1.9 KiB
PHP
57 lines
1.9 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../inc/auth.php';
|
|
|
|
$error = '';
|
|
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$username = $_POST['username'] ?? '';
|
|
$password = $_POST['password'] ?? '';
|
|
|
|
if (authenticate_user($username, $password)) {
|
|
header('Location: index.php');
|
|
exit;
|
|
} else {
|
|
$error = 'Invalid username or password.';
|
|
}
|
|
}
|
|
?>
|
|
<!doctype html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1">
|
|
<title>Admin Login | The Old Fitz Public House</title>
|
|
<link rel="preconnect" href="https://fonts.googleapis.com">
|
|
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
|
|
<link href="https://fonts.googleapis.com/css2?family=Fraunces:wght@600&family=Karla:wght@400;500;600&family=IBM+Plex+Mono:wght@400;500&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="../styles.css">
|
|
</head>
|
|
<body class="admin-login-body">
|
|
<div class="login-card">
|
|
<div class="login-header">
|
|
<img src="../assets/knot.png" alt="" class="knot">
|
|
<h1>The Old Fitz</h1>
|
|
<p>Management Portal</p>
|
|
</div>
|
|
|
|
<?php if (!empty($error)): ?>
|
|
<div class="error-msg" role="alert"><?= htmlspecialchars($error) ?></div>
|
|
<?php endif; ?>
|
|
|
|
<form method="POST" action="login.php">
|
|
<div class="form-group">
|
|
<label for="username">Username</label>
|
|
<input type="text" id="username" name="username" class="form-input" required autofocus autocomplete="username">
|
|
</div>
|
|
<div class="form-group">
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" class="form-input" required autocomplete="current-password">
|
|
</div>
|
|
<button type="submit" class="btn btn-primary login-btn">Sign In</button>
|
|
</form>
|
|
|
|
<a href="../" class="back-link">← Return to Pub Website</a>
|
|
</div>
|
|
</body>
|
|
</html>
|