48 lines
1.7 KiB
PHP
48 lines
1.7 KiB
PHP
<?php
|
|
require_once __DIR__ . '/../includes/auth.php';
|
|
|
|
$error = '';
|
|
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|
$email = trim($_POST['email'] ?? '');
|
|
$password = trim($_POST['password'] ?? '');
|
|
if ($email === '' || $password === '') {
|
|
$error = 'Email and password are required.';
|
|
} elseif (attempt_login($email, $password)) {
|
|
header('Location: /admin/resources.php');
|
|
exit;
|
|
} else {
|
|
$error = 'Invalid credentials.';
|
|
}
|
|
}
|
|
|
|
$pageTitle = 'Admin Login';
|
|
$currentPage = '';
|
|
$assetPathPrefix = '../';
|
|
require __DIR__ . '/../includes/admin-header.php';
|
|
?>
|
|
|
|
<main class="section">
|
|
<div class="container" style="max-width:480px;">
|
|
<div class="card">
|
|
<h2>Admin Login</h2>
|
|
<?php if ($error): ?>
|
|
<div class="alert bad" style="margin-top:12px;"><?php echo htmlspecialchars($error); ?></div>
|
|
<?php endif; ?>
|
|
<form method="post" style="display:grid; gap:12px; margin-top:12px;">
|
|
<div>
|
|
<label for="email">Email</label>
|
|
<input type="email" id="email" name="email" required placeholder="admin@example.com">
|
|
</div>
|
|
<div>
|
|
<label for="password">Password</label>
|
|
<input type="password" id="password" name="password" required placeholder="••••••••">
|
|
</div>
|
|
<button class="btn primary" type="submit">Login</button>
|
|
<p class="body muted" style="font-size:13px;">Default admin: ravi@stratawiz.com / qwerty</p>
|
|
</form>
|
|
</div>
|
|
</div>
|
|
</main>
|
|
|
|
<?php require __DIR__ . '/../includes/admin-footer.php'; ?>
|