r
This commit is contained in:
parent
5ee3262843
commit
517061dddb
@ -16,7 +16,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
$username = trim($_POST['username'] ?? '');
|
$username = trim($_POST['username'] ?? '');
|
||||||
$password = trim($_POST['password'] ?? '');
|
$password = trim($_POST['password'] ?? '');
|
||||||
if (login_admin($username, $password)) {
|
if (login_admin($username, $password)) {
|
||||||
flash_set('success', 'Login berhasil. Selamat datang admin.');
|
|
||||||
header('Location: admin_dashboard.php');
|
header('Location: admin_dashboard.php');
|
||||||
exit;
|
exit;
|
||||||
}
|
}
|
||||||
@ -26,8 +25,6 @@ if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
|||||||
}
|
}
|
||||||
|
|
||||||
$flash = flash_get();
|
$flash = flash_get();
|
||||||
$projectDescription = $_SERVER['PROJECT_DESCRIPTION'] ?? '';
|
|
||||||
$projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|
||||||
?>
|
?>
|
||||||
<!doctype html>
|
<!doctype html>
|
||||||
<html lang="id">
|
<html lang="id">
|
||||||
@ -35,54 +32,35 @@ $projectImageUrl = $_SERVER['PROJECT_IMAGE_URL'] ?? '';
|
|||||||
<meta charset="utf-8" />
|
<meta charset="utf-8" />
|
||||||
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
<meta name="viewport" content="width=device-width, initial-scale=1" />
|
||||||
<title>Login Admin</title>
|
<title>Login Admin</title>
|
||||||
<?php if ($projectDescription): ?>
|
|
||||||
<meta name="description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<meta property="og:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<meta property="twitter:description" content="<?= htmlspecialchars($projectDescription) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<?php if ($projectImageUrl): ?>
|
|
||||||
<meta property="og:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<meta property="twitter:image" content="<?= htmlspecialchars($projectImageUrl) ?>" />
|
|
||||||
<?php endif; ?>
|
|
||||||
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
<link href="https://fonts.googleapis.com/css2?family=Inter:wght@400;500;600;700&display=swap" rel="stylesheet">
|
||||||
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
<link href="https://cdn.jsdelivr.net/npm/bootstrap@5.3.3/dist/css/bootstrap.min.css" rel="stylesheet">
|
||||||
<link rel="stylesheet" href="assets/css/custom.css?v=<?= time() ?>">
|
|
||||||
</head>
|
</head>
|
||||||
<body class="app-body">
|
<body class="bg-light">
|
||||||
<div class="container py-5">
|
<div class="container py-5">
|
||||||
<div class="row justify-content-center">
|
<div class="row justify-content-center">
|
||||||
<div class="col-lg-5">
|
<div class="col-lg-5">
|
||||||
<div class="card shadow-sm border-0">
|
<div class="card shadow-sm border-0">
|
||||||
<div class="card-body">
|
<div class="card-body">
|
||||||
<h1 class="h4 fw-semibold mb-3">Login Admin</h1>
|
<h1 class="h4 fw-semibold mb-3">Login Admin</h1>
|
||||||
<p class="text-muted small">Gunakan kredensial admin untuk mengakses laporan pendaftar.</p>
|
|
||||||
<?php if ($flash): ?>
|
<?php if ($flash): ?>
|
||||||
<div class="alert alert-<?= htmlspecialchars($flash['type']) ?> border-0 small">
|
<div class="alert alert-<?= htmlspecialchars($flash['type']) ?> border-0 small">
|
||||||
<?= htmlspecialchars($flash['message']) ?>
|
<?= htmlspecialchars($flash['message']) ?>
|
||||||
</div>
|
</div>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
<form method="post" class="needs-validation" novalidate>
|
<form method="post">
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="username">Username</label>
|
<label class="form-label" for="username">Username</label>
|
||||||
<input type="text" class="form-control" id="username" name="username" required>
|
<input type="text" class="form-control" id="username" name="username" required>
|
||||||
<div class="invalid-feedback">Username wajib diisi.</div>
|
|
||||||
</div>
|
</div>
|
||||||
<div class="mb-3">
|
<div class="mb-3">
|
||||||
<label class="form-label" for="password">Password</label>
|
<label class="form-label" for="password">Password</label>
|
||||||
<input type="password" class="form-control" id="password" name="password" required>
|
<input type="password" class="form-control" id="password" name="password" required>
|
||||||
<div class="invalid-feedback">Password wajib diisi.</div>
|
|
||||||
</div>
|
</div>
|
||||||
<button type="submit" class="btn btn-dark w-100">Masuk</button>
|
<button type="submit" class="btn btn-dark w-100">Masuk</button>
|
||||||
</form>
|
</form>
|
||||||
<div class="border-top pt-3 mt-4 small text-muted">
|
|
||||||
Default demo: <strong>admin / admin123</strong>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
<div class="text-center mt-3">
|
|
||||||
<a class="text-muted small" href="/">Kembali ke halaman utama</a>
|
|
||||||
</div>
|
|
||||||
</div>
|
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</body>
|
</body>
|
||||||
|
|||||||
@ -7,7 +7,7 @@ if (session_status() === PHP_SESSION_NONE) {
|
|||||||
|
|
||||||
// Credentials
|
// Credentials
|
||||||
const ADMIN_USERNAME = 'roni';
|
const ADMIN_USERNAME = 'roni';
|
||||||
const ADMIN_PASSWORD_HASH = '$2y$10$hkUDAZesiL6CbEdU34ovGOEDmfAjfeAF9E5eu.Yxlv0xO8aX5UBIW'; // Hash of 'wijaya91'
|
const ADMIN_PASSWORD_HASH = '$2y$10$dxyVYBKFCObI9vbpngH04OVMAUzMnpm5sy.w3Ex704xLjknaL7Vy6';
|
||||||
|
|
||||||
function is_admin_logged_in(): bool {
|
function is_admin_logged_in(): bool {
|
||||||
return !empty($_SESSION['admin_logged_in']);
|
return !empty($_SESSION['admin_logged_in']);
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user