<?php
// admin_login.php
require_once 'includes/db.php';
if (isAdmin()) redirect('admin_dashboard.php');
$error = '';
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$user = $_POST['username'];
$pass = $_POST['password'];
// Simple admin/admin credentials as requested
if ($user === 'admin' && $pass === 'admin') {
$_SESSION['admin_logged_in'] = true;
redirect('admin_dashboard.php');
} else {
$error = 'Invalid username or password.';
}
}
require_once 'includes/header.php';
?>
<div class="flex justify-center items-center py-20">
<div class="glass w-full max-w-md p-10 rounded-[2.5rem] shadow-2xl">
<h1 class="text-3xl font-black text-white text-center mb-8">Admin Access</h1>
<?php if($error): ?>
<div class="p-4 bg-red-900/20 border border-red-500/50 text-red-400 text-sm rounded-xl mb-6 text-center">
<?php echo $error; ?>
</div>
<?php endif; ?>
<form method="POST" class="space-y-6">
<div>
<label class="block text-xs font-black text-slate-500 uppercase tracking-widest mb-2 ml-1">Username</label>
<input type="text" name="username" required
class="w-full bg-slate-900 border border-slate-700 rounded-2xl px-6 py-4 text-white focus:ring-4 focus:ring-blue-500/20 outline-none transition-all">
</div>
<div>
<label class="block text-xs font-black text-slate-500 uppercase tracking-widest mb-2 ml-1">Password</label>
<input type="password" name="password" required
class="w-full bg-slate-900 border border-slate-700 rounded-2xl px-6 py-4 text-white focus:ring-4 focus:ring-blue-500/20 outline-none transition-all">
</div>
<button type="submit" class="w-full py-4 bg-blue-600 hover:bg-blue-700 text-white font-black rounded-2xl transition-all shadow-xl mt-4">
Secure Login
</button>
</form>
</div>
</div>
<?php require_once 'includes/footer.php'; ?>