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:
2026-06-10 17:44:46 +07:00
parent c6087ed7dd
commit e98a8ecec9
34 changed files with 963 additions and 211 deletions
+51
View File
@@ -0,0 +1,51 @@
<?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 Geometri</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:#22c55e;">G</div>
<div class="logo-text">ADMIN<span style="color:#22c55e;"> GEOMETRI</span></div>
</div>
<div class="header-divider"></div>
<span style="font-size:12px;color:var(--muted);">Kelola Point, Polyline, Polygon</span>
<div class="legend">
<div class="legend-item"><div class="legend-dot" style="background:#3b82f6"></div> Point</div>
<div class="legend-item"><div class="legend-line" style="background:#a855f7"></div> Polyline/Jalan</div>
<div class="legend-item"><div class="legend-poly" style="background:#10b981"></div> Polygon/Parsil</div>
</div>
<div class="layer-sep"></div>
<div class="layer-control">
<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 src="https://unpkg.com/leaflet-geometryutil/src/leaflet.geometryutil.js"></script>
<script>window.IS_ADMIN = true;</script>
<script src="../js/draw_geometri.js?v=<?= time() ?>"></script>
</body>
</html>
+9 -5
View File
@@ -9,7 +9,6 @@
<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>
@@ -23,7 +22,13 @@
<div class="header-divider"></div>
<span style="font-size:12px;color:var(--muted);">Point, Polyline, Polygon</span>
<div class="legend">
<div class="layer-control" style="margin-left:auto;">
<a href="login.php" class="layer-btn" style="text-decoration:none; color:#22c55e; border-color:#22c55e33;">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:#3b82f6"></div> Point
</div>
@@ -39,9 +44,8 @@
<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 src="https://unpkg.com/leaflet-geometryutil/src/leaflet.geometryutil.js"></script>
<script src="../js/draw_geometri.js"></script>
<script>window.IS_ADMIN = false;</script>
<script src="../js/draw_geometri.js?v=<?= time() ?>"></script>
</body>
</html>
+92
View File
@@ -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 Geometri</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(34,197,94,.04) 1px, transparent 1px),linear-gradient(90deg, rgba(34,197,94,.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,#166534,#22c55e); 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:#22c55e; }
.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:#22c55e; }
.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,#166534,#22c55e); 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">G</div>
<div>
<div class="login-logo-text">WEB<span>GIS</span> GEOMETRI</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 point, polyline, dan polygon.</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>
+6
View File
@@ -0,0 +1,6 @@
<?php
session_start();
session_destroy();
header('Location: index.php');
exit;
?>