Project Webgis2 SIG

This commit is contained in:
2026-06-11 10:38:09 +07:00
commit eb4d6b7eb0
22 changed files with 2914 additions and 0 deletions
+55
View File
@@ -0,0 +1,55 @@
<?php
include 'koneksi.php';
$features = [];
// ====================
// IBADAH
// ====================
$q1 = $conn->query("SELECT * FROM ibadah");
while ($row = $q1->fetch_assoc()) {
$features[] = [
"type" => "Feature",
"properties" => [
"tipe" => "ibadah",
"id" => $row['id'],
"nama" => $row['nama'],
"jenis" => $row['jenis'],
"radius" => $row['radius']
],
"geometry" => [
"type" => "Point",
"coordinates" => [(float)$row['lng'], (float)$row['lat']]
]
];
}
// ====================
// WARGA
// ====================
$q2 = $conn->query("SELECT * FROM warga");
while ($row = $q2->fetch_assoc()) {
$features[] = [
"type" => "Feature",
"properties" => [
"tipe" => "warga",
"id" => $row['id'],
"nama" => $row['nama'],
"jumlah_kk" => $row['jumlah_kk'],
"pengurus" => $row['pengurus']
],
"geometry" => [
"type" => "Point",
"coordinates" => [(float)$row['lng'], (float)$row['lat']]
]
];
}
// output GeoJSON
echo json_encode([
"type" => "FeatureCollection",
"features" => $features
]);
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
include 'koneksi.php';
$id = $_GET['id'];
$conn->query("DELETE FROM ibadah WHERE id=$id");
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
include 'koneksi.php';
$id = $_GET['id'];
$conn->query("DELETE FROM warga WHERE id=$id");
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
$conn = new mysqli("localhost", "root", "", "sig_pontianak");
if ($conn->connect_error) {
die("Koneksi gagal: " . $conn->connect_error);
}
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$nama = $data['nama'];
$jenis = $data['jenis'];
$lat = $data['lat'];
$lng = $data['lng'];
$radius = $data['radius'];
$sql = "INSERT INTO ibadah (nama, jenis, lat, lng, radius)
VALUES ('$nama', '$jenis', '$lat', '$lng', '$radius')";
$conn->query($sql);
echo json_encode([
"id" => $conn->insert_id
]);
?>
+20
View File
@@ -0,0 +1,20 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$nama = $data['nama'];
$jumlah = $data['jumlah'];
$lat = $data['lat'];
$lng = $data['lng'];
$pengurus = $data['pengurus'];
$sql = "INSERT INTO warga (nama, jumlah_kk, lat, lng, pengurus)
VALUES ('$nama', '$jumlah', '$lat', '$lng', '$pengurus')";
$conn->query($sql);
echo json_encode([
"id" => $conn->insert_id
]);
?>
+18
View File
@@ -0,0 +1,18 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$id = $data['id'];
$nama = $data['nama'];
$jenis = $data['jenis'];
$radius = $data['radius'];
$sql = "UPDATE ibadah
SET nama='$nama',
jenis='$jenis',
radius='$radius'
WHERE id=$id";
$conn->query($sql);
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$id = $data['id'];
$pengurus = $data['pengurus'];
$sql = "UPDATE warga
SET pengurus='$pengurus'
WHERE id=$id";
$conn->query($sql);
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$id = $data['id'];
$radius = $data['radius'];
$sql = "UPDATE ibadah
SET radius='$radius'
WHERE id=$id";
$conn->query($sql);
?>
+16
View File
@@ -0,0 +1,16 @@
<?php
include 'koneksi.php';
$data = json_decode(file_get_contents("php://input"), true);
$id = $data['id'];
$nama = $data['nama'];
$jumlah = $data['jumlah'];
$sql = "UPDATE ibadah
SET nama='$nama',
jumlah_kk='$jumlah',
WHERE id=$id";
$conn->query($sql);
?>