80 lines
2.9 KiB
PHP
80 lines
2.9 KiB
PHP
<?php
|
|
session_start();
|
|
if (isset($_SESSION['loggedin']) && $_SESSION['loggedin'] === true) {
|
|
header('Location: dashboard.php');
|
|
exit;
|
|
}
|
|
|
|
$error = '';
|
|
if ($_SERVER["REQUEST_METHOD"] == "POST") {
|
|
$username = 'admin'; // Hardcoded for now
|
|
$password = 'password'; // Hardcoded for now
|
|
|
|
if ($_POST['username'] === $username && $_POST['password'] === $password) {
|
|
$_SESSION['loggedin'] = true;
|
|
$_SESSION['username'] = $username;
|
|
header('Location: dashboard.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.0">
|
|
<title>Admin Login - Juanda Transport</title>
|
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/css/bootstrap.min.css" rel="stylesheet">
|
|
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.3/font/bootstrap-icons.min.css">
|
|
<link href="https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap" rel="stylesheet">
|
|
<link rel="stylesheet" href="assets/css/custom.css">
|
|
<style>
|
|
body {
|
|
display: flex;
|
|
align-items: center;
|
|
justify-content: center;
|
|
min-height: 100vh;
|
|
background-color: #f8f9fa;
|
|
font-family: 'Poppins', sans-serif;
|
|
}
|
|
.login-card {
|
|
max-width: 400px;
|
|
width: 100%;
|
|
}
|
|
</style>
|
|
</head>
|
|
<body>
|
|
<div class="card login-card shadow-sm">
|
|
<div class="card-body p-5">
|
|
<h3 class="card-title text-center mb-4">Admin Login</h3>
|
|
<div class="text-center mb-4">
|
|
<a href="index.php">
|
|
<img src="https://www.flatlogic.com/assets/logo-c69533d8159b5d5b5a5d27dc2b6045a3.svg" alt="Juanda Transport Logo" height="40">
|
|
</a>
|
|
</div>
|
|
<?php if ($error): ?>
|
|
<div class="alert alert-danger"><?php echo $error; ?></div>
|
|
<?php endif; ?>
|
|
<form action="admin.php" method="POST">
|
|
<div class="mb-3">
|
|
<label for="username" class="form-label">Username</label>
|
|
<input type="text" class="form-control" id="username" name="username" required>
|
|
</div>
|
|
<div class="mb-3">
|
|
<label for="password" class="form-label">Password</label>
|
|
<input type="password" class="form-control" id="password" name="password" required>
|
|
</div>
|
|
<div class="d-grid">
|
|
<button type="submit" class="btn btn-primary">Login</button>
|
|
</div>
|
|
</form>
|
|
<div class="text-center mt-3">
|
|
<small>Use <strong>admin</strong> / <strong>password</strong> to login.</small>
|
|
</div>
|
|
</div>
|
|
</div>
|
|
</body>
|
|
</html>
|