|
Server : LiteSpeed System : Linux terra.hostitbro.com 5.14.0-611.54.3.el9_7.x86_64 #1 SMP PREEMPT_DYNAMIC Thu May 7 16:31:24 EDT 2026 x86_64 User : outerorb ( 1091) PHP Version : 8.1.34 Disable Function : mail Directory : /home2/outerorb/emp.outerorbittech.in/admin/ | |
|
Path: /home2/outerorb/emp.outerorbittech.in/admin/login.php
Size: 2.69 KB
Permissions: 0666
<?php
require __DIR__ . '/../includes/helpers.php';
// Login is now handled by the unified login page at the project root.
header('Location: ../index.php');
exit;
$flash = flash();
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
if (!isset($_POST['csrf_token']) || !verify_csrf($_POST['csrf_token'])) {
redirect_with_message('login.php', 'Invalid session token.', 'error');
}
$username = sanitize_text($_POST['username'] ?? '');
$password = $_POST['password'] ?? '';
$admin = authenticate_admin($username, $password);
if ($admin) {
$_SESSION['admin_logged_in'] = true;
$_SESSION['admin'] = $admin;
redirect_with_message('dashboard.php', 'Welcome back.');
}
redirect_with_message('login.php', 'Invalid credentials.', 'error');
}
?>
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Admin Login</title>
<link rel="stylesheet" href="../assets/css/style.css?v=<?php echo filemtime(__DIR__ . '/../assets/css/style.css'); ?>" />
<link rel="stylesheet" href="../assets/css/polish.css?v=<?php echo filemtime(__DIR__ . '/../assets/css/polish.css'); ?>" />
</head>
<body>
<div class="container">
<div class="header">
<div class="brand">
<div class="brand-title">
<h1 style="margin:0;">Admin Login</h1>
<p class="helper" style="margin:2px 0 0 0;">Secure access for administrators.</p>
</div>
</div>
<a class="badge" href="../index.php">Back to form</a>
</div>
<div class="card" style="max-width: 520px; margin: 0 auto;">
<?php if ($flash): ?>
<div class="alert <?php echo $flash['type'] === 'error' ? 'alert-error' : 'alert-success'; ?>">
<?php echo htmlspecialchars($flash['message'], ENT_QUOTES, 'UTF-8'); ?>
</div>
<?php endif; ?>
<form method="post" action="login.php" novalidate>
<input type="hidden" name="csrf_token" value="<?php echo csrf_token(); ?>" />
<div style="display: flex; flex-direction: column; gap: 14px;">
<div>
<label for="username">Username</label>
<input id="username" name="username" type="text" required />
</div>
<div>
<label for="password">Password</label>
<input id="password" name="password" type="password" required />
</div>
<button type="submit">Log In</button>
</div>
</form>
</div>
</div>
</body>
</html>