From 7f5da17697e981c4e92ce32626efa88d7119df30 Mon Sep 17 00:00:00 2001 From: YaraAqmal Date: Sun, 7 Jun 2026 13:41:05 +0700 Subject: [PATCH] Initial commit - Fresh Clean Code --- LinkWebsite_SPBU_Marker.txt | 1 + api_spbu.php | 36 +++++ config.php | 26 ++++ index.html | 285 ++++++++++++++++++++++++++++++++++++ 4 files changed, 348 insertions(+) create mode 100644 LinkWebsite_SPBU_Marker.txt create mode 100644 api_spbu.php create mode 100644 config.php create mode 100644 index.html diff --git a/LinkWebsite_SPBU_Marker.txt b/LinkWebsite_SPBU_Marker.txt new file mode 100644 index 0000000..aa08eb1 --- /dev/null +++ b/LinkWebsite_SPBU_Marker.txt @@ -0,0 +1 @@ +https://sigwebsite.free.je/SPBU_Marker/ \ No newline at end of file diff --git a/api_spbu.php b/api_spbu.php new file mode 100644 index 0000000..05c31de --- /dev/null +++ b/api_spbu.php @@ -0,0 +1,36 @@ +query("SELECT * FROM spbu ORDER BY created_at DESC"); + $data = []; + while ($row = $result->fetch_assoc()) { $data[] = $row; } + sendResponse(true, 'Data dimuat', $data); +} +elseif ($method === 'POST' && $action === 'create') { + $input = json_decode(file_get_contents('php://input'), true); + $stmt = $conn->prepare("INSERT INTO spbu (nama, no_spbu, alamat, tipe, latitude, longitude) VALUES (?, ?, ?, ?, ?, ?)"); + $stmt->bind_param("ssssdd", $input['nama'], $input['no_spbu'], $input['alamat'], $input['tipe'], $input['latitude'], $input['longitude']); + if ($stmt->execute()) sendResponse(true, 'Berhasil simpan', ['id' => $conn->insert_id]); + else sendResponse(false, 'Gagal simpan: ' . $stmt->error); +} +elseif ($method === 'PUT' && $action === 'update') { + $id = intval($_GET['id']); + $input = json_decode(file_get_contents('php://input'), true); + $stmt = $conn->prepare("UPDATE spbu SET nama=?, no_spbu=?, alamat=?, tipe=?, latitude=?, longitude=? WHERE id=?"); + $stmt->bind_param("ssssddi", $input['nama'], $input['no_spbu'], $input['alamat'], $input['tipe'], $input['latitude'], $input['longitude'], $id); + if ($stmt->execute()) sendResponse(true, 'Berhasil update'); + else sendResponse(false, 'Gagal update'); +} +elseif ($method === 'DELETE' && $action === 'delete') { + $id = intval($_GET['id']); + $stmt = $conn->prepare("DELETE FROM spbu WHERE id=?"); + $stmt->bind_param("i", $id); + if ($stmt->execute()) sendResponse(true, 'Berhasil hapus'); + else sendResponse(false, 'Gagal hapus'); +} +?> \ No newline at end of file diff --git a/config.php b/config.php new file mode 100644 index 0000000..d2e8a3a --- /dev/null +++ b/config.php @@ -0,0 +1,26 @@ +connect_error) { + die(json_encode(['success' => false, 'message' => 'Koneksi gagal: ' . $conn->connect_error])); +} + +$conn->set_charset("utf8"); + +function sendResponse($success, $message, $data = null) { + echo json_encode(['success' => $success, 'message' => $message, 'data' => $data]); + exit; +} +?> \ No newline at end of file diff --git a/index.html b/index.html new file mode 100644 index 0000000..45e8286 --- /dev/null +++ b/index.html @@ -0,0 +1,285 @@ + + + + + Sistem GIS SPBU - Mandiri + + + + + + + +
+
+
+
+
+ +
+ + Navigasi: Klik item di daftar untuk Edit. Geser pin di peta untuk pindah lokasi. +
+
+
+ +
+ +
+
+
+ + + + + \ No newline at end of file