update sistem proyek menjadi lebih struktural. dimulai dengan memisahkan dashboard publik dan administrator pada setiap proyek, membuat dockerfile untuk setup environment docker, dan merapikan database serta membuat file migration.
This commit is contained in:
@@ -0,0 +1,59 @@
|
||||
<?php
|
||||
require_once '../php/auth.php';
|
||||
require_roles_page(['admin']);
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Panel Admin - WebGIS SPBU</title>
|
||||
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
|
||||
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet-draw/dist/leaflet.draw.css"/>
|
||||
<link rel="stylesheet" href="../css/style.css"/>
|
||||
</head>
|
||||
<body>
|
||||
|
||||
<header>
|
||||
<a href="index.php" class="back-btn" title="Lihat Dashboard Publik">←</a>
|
||||
<div class="logo">
|
||||
<div class="logo-icon" style="background:#3b82f6;">S</div>
|
||||
<div class="logo-text">ADMIN<span style="color:#60a5fa;"> SPBU</span></div>
|
||||
</div>
|
||||
<div class="header-divider"></div>
|
||||
<span style="font-size:12px;color:var(--muted);">Kelola Titik SPBU Pontianak</span>
|
||||
|
||||
<div class="legend">
|
||||
<div class="legend-item"><div class="legend-dot" style="background:#4ade80"></div> SPBU 24 Jam</div>
|
||||
<div class="legend-item"><div class="legend-dot" style="background:#f87171"></div> Tidak 24 Jam</div>
|
||||
<div class="legend-item"><div class="legend-dot" style="background:#3b82f6"></div> Titik SPBU</div>
|
||||
</div>
|
||||
|
||||
<div class="layer-sep"></div>
|
||||
<div class="layer-control">
|
||||
<button class="layer-btn btn-24 active" id="btn24" onclick="toggleLayer('24jam')">
|
||||
<span class="dot" style="background:#4ade80"></span>
|
||||
24 Jam
|
||||
</button>
|
||||
<button class="layer-btn btn-tidak active" id="btnTidak" onclick="toggleLayer('tidak')">
|
||||
<span class="dot" style="background:#f87171"></span>
|
||||
Tidak 24 Jam
|
||||
</button>
|
||||
<div class="layer-sep"></div>
|
||||
<a href="logout.php" class="layer-btn" style="text-decoration:none; color:#ef4444; border-color:#ef444433;">Keluar</a>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="map"></div>
|
||||
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
<script src="https://unpkg.com/leaflet-draw/dist/leaflet.draw.js"></script>
|
||||
<script>window.IS_ADMIN = true;</script>
|
||||
<script src="../js/draw_spbu_point.js?v=<?= time() ?>"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
+18
-18
@@ -11,7 +11,6 @@
|
||||
|
||||
<!-- Leaflet -->
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet/dist/leaflet.css"/>
|
||||
<link rel="stylesheet" href="https://unpkg.com/leaflet-draw/dist/leaflet.draw.css"/>
|
||||
|
||||
<!-- App styles -->
|
||||
<link rel="stylesheet" href="../css/style.css"/>
|
||||
@@ -27,7 +26,22 @@
|
||||
<div class="header-divider"></div>
|
||||
<span style="font-size:12px;color:var(--muted);">Pontianak, Kalimantan Barat</span>
|
||||
|
||||
<div class="legend">
|
||||
<div class="layer-control" style="margin-left:auto;">
|
||||
<button class="layer-btn btn-24 active" id="btn24" onclick="toggleLayer('24jam')">
|
||||
<span class="dot" style="background:#4ade80"></span>
|
||||
24 Jam
|
||||
</button>
|
||||
<button class="layer-btn btn-tidak active" id="btnTidak" onclick="toggleLayer('tidak')">
|
||||
<span class="dot" style="background:#f87171"></span>
|
||||
Tidak 24 Jam
|
||||
</button>
|
||||
<div class="layer-sep"></div>
|
||||
<a href="login.php" class="layer-btn" style="text-decoration:none; color:#60a5fa; border-color:#60a5fa33;">Admin Login</a>
|
||||
</div>
|
||||
|
||||
<div class="layer-sep"></div>
|
||||
|
||||
<div class="legend" style="margin-left:0;">
|
||||
<div class="legend-item">
|
||||
<div class="legend-dot" style="background:#4ade80"></div> SPBU 24 Jam
|
||||
</div>
|
||||
@@ -38,30 +52,16 @@
|
||||
<div class="legend-dot" style="background:#3b82f6"></div> Titik SPBU
|
||||
</div>
|
||||
</div>
|
||||
|
||||
<div class="layer-sep"></div>
|
||||
|
||||
<!-- Toggle SPBU -->
|
||||
<div class="layer-control">
|
||||
<button class="layer-btn btn-24 active" id="btn24" onclick="toggleLayer('24jam')">
|
||||
<span class="dot" style="background:#4ade80"></span>
|
||||
24 Jam
|
||||
</button>
|
||||
<button class="layer-btn btn-tidak active" id="btnTidak" onclick="toggleLayer('tidak')">
|
||||
<span class="dot" style="background:#f87171"></span>
|
||||
Tidak 24 Jam
|
||||
</button>
|
||||
</div>
|
||||
</header>
|
||||
|
||||
<div id="map"></div>
|
||||
|
||||
<!-- Leaflet JS -->
|
||||
<script src="https://unpkg.com/leaflet/dist/leaflet.js"></script>
|
||||
<script src="https://unpkg.com/leaflet-draw/dist/leaflet.draw.js"></script>
|
||||
|
||||
<!-- App script -->
|
||||
<script src="../js/draw_spbu_point.js"></script>
|
||||
<script>window.IS_ADMIN = false;</script>
|
||||
<script src="../js/draw_spbu_point.js?v=<?= time() ?>"></script>
|
||||
|
||||
</body>
|
||||
</html>
|
||||
|
||||
@@ -0,0 +1,92 @@
|
||||
<?php
|
||||
session_start();
|
||||
include '../php/db.php';
|
||||
|
||||
$error = '';
|
||||
|
||||
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
|
||||
$user = trim($_POST['username'] ?? '');
|
||||
$pass = $_POST['password'] ?? '';
|
||||
|
||||
$stmt = $conn->prepare("SELECT id, username, password_hash, role, full_name, is_active FROM users WHERE username = ? LIMIT 1");
|
||||
if (!$stmt) {
|
||||
$error = 'Konfigurasi login belum siap. Jalankan migration database terlebih dahulu.';
|
||||
} else {
|
||||
$stmt->bind_param("s", $user);
|
||||
$stmt->execute();
|
||||
$result = $stmt->get_result();
|
||||
$account = $result ? $result->fetch_assoc() : null;
|
||||
|
||||
if ($account && intval($account['is_active']) === 1 && password_verify($pass, $account['password_hash'])) {
|
||||
session_regenerate_id(true);
|
||||
$_SESSION['user_id'] = intval($account['id']);
|
||||
$_SESSION['username'] = $account['username'];
|
||||
$_SESSION['role'] = $account['role'];
|
||||
$_SESSION['full_name'] = $account['full_name'];
|
||||
$_SESSION['is_admin'] = $account['role'] === 'admin';
|
||||
|
||||
header('Location: ' . ($account['role'] === 'admin' ? 'admin.php' : 'index.php'));
|
||||
exit;
|
||||
}
|
||||
|
||||
$error = 'Username atau password salah.';
|
||||
$stmt->close();
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($conn)) {
|
||||
$conn->close();
|
||||
}
|
||||
?>
|
||||
<!DOCTYPE html>
|
||||
<html lang="id">
|
||||
<head>
|
||||
<meta charset="UTF-8">
|
||||
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
||||
<title>Login Admin - WebGIS SPBU</title>
|
||||
<link rel="preconnect" href="https://fonts.googleapis.com">
|
||||
<link href="https://fonts.googleapis.com/css2?family=Space+Mono:wght@400;700&family=DM+Sans:wght@300;400;500;600&display=swap" rel="stylesheet">
|
||||
<style>
|
||||
*, *::before, *::after { box-sizing: border-box; margin: 0; padding: 0; }
|
||||
body { font-family:'DM Sans',sans-serif; background:#0a0d14; color:#e2e8f0; min-height:100vh; display:flex; align-items:center; justify-content:center; padding:20px; }
|
||||
body::before { content:''; position:fixed; inset:0; background-image:linear-gradient(rgba(59,130,246,.04) 1px, transparent 1px),linear-gradient(90deg, rgba(59,130,246,.04) 1px, transparent 1px); background-size:40px 40px; }
|
||||
.login-card { position:relative; z-index:1; width:100%; max-width:380px; background:#1a1d27; border:1px solid #2a2d3a; border-radius:16px; padding:36px 32px; box-shadow:0 25px 60px rgba(0,0,0,.5); }
|
||||
.login-logo { display:flex; align-items:center; gap:12px; margin-bottom:28px; }
|
||||
.login-logo-icon { width:44px; height:44px; background:linear-gradient(135deg,#1d4ed8,#3b82f6); border-radius:12px; display:flex; align-items:center; justify-content:center; font-weight:700; }
|
||||
.login-logo-text { font-family:'Space Mono',monospace; font-size:14px; font-weight:700; letter-spacing:.05em; }
|
||||
.login-logo-text span { color:#60a5fa; }
|
||||
.login-logo-sub { font-size:11px; color:#6b7280; margin-top:1px; }
|
||||
h1 { font-size:20px; margin-bottom:6px; }
|
||||
.login-desc { font-size:13px; color:#6b7280; margin-bottom:24px; line-height:1.5; }
|
||||
label { display:block; font-size:11px; color:#9ca3af; font-weight:600; letter-spacing:.05em; text-transform:uppercase; margin-bottom:6px; margin-top:16px; }
|
||||
input { width:100%; background:#0f1117; border:1px solid #2a2d3a; color:#e2e8f0; border-radius:8px; padding:10px 14px; font-size:14px; font-family:'DM Sans',sans-serif; outline:none; }
|
||||
input:focus { border-color:#60a5fa; }
|
||||
.error-msg { background:rgba(239,68,68,.1); border:1px solid rgba(239,68,68,.3); color:#f87171; border-radius:8px; padding:10px 14px; font-size:13px; margin-top:16px; }
|
||||
.btn-login { width:100%; margin-top:24px; padding:12px; background:linear-gradient(135deg,#1d4ed8,#3b82f6); color:#fff; border:0; border-radius:8px; font-size:14px; font-weight:700; font-family:'DM Sans',sans-serif; cursor:pointer; }
|
||||
.back-link { display:block; text-align:center; margin-top:16px; font-size:12px; color:#6b7280; text-decoration:none; }
|
||||
.back-link:hover { color:#e2e8f0; }
|
||||
</style>
|
||||
</head>
|
||||
<body>
|
||||
<div class="login-card">
|
||||
<div class="login-logo">
|
||||
<div class="login-logo-icon">S</div>
|
||||
<div>
|
||||
<div class="login-logo-text">WEB<span>GIS</span> SPBU</div>
|
||||
<div class="login-logo-sub">Portal Administrasi</div>
|
||||
</div>
|
||||
</div>
|
||||
<h1>Masuk Admin</h1>
|
||||
<p class="login-desc">Halaman ini khusus untuk pengelola data titik SPBU.</p>
|
||||
<?php if ($error): ?><div class="error-msg"><?= htmlspecialchars($error) ?></div><?php endif; ?>
|
||||
<form method="POST">
|
||||
<label for="username">Username</label>
|
||||
<input type="text" id="username" name="username" placeholder="admin" autocomplete="off" required>
|
||||
<label for="password">Password</label>
|
||||
<input type="password" id="password" name="password" placeholder="password" required>
|
||||
<button type="submit" class="btn-login">Masuk</button>
|
||||
</form>
|
||||
<a href="index.php" class="back-link">Kembali ke Dashboard Publik</a>
|
||||
</div>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,6 @@
|
||||
<?php
|
||||
session_start();
|
||||
session_destroy();
|
||||
header('Location: index.php');
|
||||
exit;
|
||||
?>
|
||||
Reference in New Issue
Block a user