mirror of
https://github.com/myronblair/tomsjavajive
synced 2026-06-30 17:50:32 -05:00
69 lines
3.1 KiB
PHP
69 lines
3.1 KiB
PHP
<?php
|
|
/**
|
|
* Tom's Java Jive - Admin Login
|
|
*/
|
|
require_once __DIR__ . '/../includes/auth.php';
|
|
|
|
if (AdminAuth::isLoggedIn()) {
|
|
header('Location: /admin/');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$email = trim($_POST['email'] ?? '');
|
|
$password = trim($_POST['password'] ?? '');
|
|
if (AdminAuth::login($email, $password)) {
|
|
$redirect = $_SESSION['admin_redirect'] ?? '/admin/';
|
|
unset($_SESSION['admin_redirect']);
|
|
header('Location: ' . $redirect);
|
|
exit;
|
|
}
|
|
$error = 'Invalid email or password.';
|
|
}
|
|
?>
|
|
<!DOCTYPE html>
|
|
<html lang="en">
|
|
<head>
|
|
<meta charset="UTF-8">
|
|
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
|
<title>Admin Login — Tom's Java Jive</title>
|
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
|
<style>
|
|
*{box-sizing:border-box;margin:0;padding:0}
|
|
body{background:#0f0f0f;font-family:Inter,sans-serif;min-height:100vh;display:flex;align-items:center;justify-content:center;padding:20px;background-image:radial-gradient(circle at 30% 50%,rgba(255,94,26,.06),transparent 50%)}
|
|
.box{background:#1a1a1a;border:1px solid #2a2a2a;border-radius:16px;padding:44px;width:100%;max-width:420px;box-shadow:0 24px 60px rgba(0,0,0,.5)}
|
|
.logo{text-align:center;margin-bottom:32px}
|
|
.logo h1{font-size:22px;font-weight:700;color:#FF5E1A;margin-bottom:4px}
|
|
.logo p{font-size:13px;color:#555;letter-spacing:.5px;text-transform:uppercase}
|
|
label{display:block;font-size:12px;font-weight:600;color:#777;text-transform:uppercase;letter-spacing:.5px;margin-bottom:7px}
|
|
input{width:100%;background:#111;border:1.5px solid #2a2a2a;border-radius:8px;padding:13px 15px;color:#fff;font-family:Inter,sans-serif;font-size:15px;outline:none;margin-bottom:18px;transition:border-color .2s}
|
|
input:focus{border-color:#FF5E1A}
|
|
.btn{width:100%;padding:14px;border:none;border-radius:8px;background:#FF5E1A;color:#fff;font-family:Inter,sans-serif;font-weight:600;font-size:15px;cursor:pointer;transition:background .2s;margin-top:4px}
|
|
.btn:hover{background:#e54d0f}
|
|
.error{background:rgba(220,38,38,.1);border:1px solid rgba(220,38,38,.3);color:#f87171;padding:12px 15px;border-radius:8px;font-size:14px;margin-bottom:20px;display:flex;align-items:center;gap:8px}
|
|
.back{display:block;text-align:center;margin-top:20px;color:#555;font-size:13px;text-decoration:none;transition:color .2s}
|
|
.back:hover{color:#FF5E1A}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="box">
|
|
<div class="logo">
|
|
<h1>☕ Tom's Java Jive</h1>
|
|
<p>Admin Panel</p>
|
|
</div>
|
|
<?php if ($error): ?>
|
|
<div class="error">⚠ <?= htmlspecialchars($error) ?></div>
|
|
<?php endif; ?>
|
|
<form method="POST">
|
|
<label>Email Address</label>
|
|
<input type="email" name="email" required autocomplete="email">
|
|
<label>Password</label>
|
|
<input type="password" name="password" placeholder="••••••••" required autocomplete="current-password">
|
|
<button type="submit" class="btn">Sign In to Admin</button>
|
|
</form>
|
|
<a href="/" class="back">← Back to Store</a>
|
|
</div>
|
|
</body>
|
|
</html>
|