Inital Commit: Landing Page & Folder Tugas-Tugas

This commit is contained in:
Vinlio Andriarles
2026-06-10 19:05:05 +07:00
commit c1dca27e27
24 changed files with 1853 additions and 0 deletions
+33
View File
@@ -0,0 +1,33 @@
<?php
include "../config/koneksi.php";
$q = mysqli_query($koneksi, "SELECT * FROM jalan");
$features = [];
while($row = mysqli_fetch_assoc($q)) {
// GeoJSON menggunakan format [longitude, latitude]
// Kita perlu membalik urutan jika di database tersimpan sebagai [lat, lng]
$raw_coords = json_decode($row['koordinat']);
$formatted_coords = [];
foreach($raw_coords as $c) {
$formatted_coords[] = [$c->lng, $c->lat];
}
$features[] = [
"type" => "Feature",
"geometry" => [
"type" => "LineString",
"coordinates" => $formatted_coords
],
"properties" => [
"id" => $row['id'],
"nama" => $row['nama_jalan'],
"status" => $row['status_jalan'],
"panjang" => $row['panjang_jalan']
]
];
}
$geojson = ["type" => "FeatureCollection", "features" => $features];
echo json_encode($geojson);
?>
+11
View File
@@ -0,0 +1,11 @@
<?php
include "../config/koneksi.php";
$id = $_GET['id'];
$query = "DELETE FROM jalan WHERE id = '$id'";
if(mysqli_query($koneksi, $query)) {
echo json_encode(['status' => 'success']);
} else {
echo json_encode(['status' => 'error']);
}
?>
+7
View File
@@ -0,0 +1,7 @@
<?php
include "../config/koneksi.php";
$query = "INSERT INTO jalan (nama_jalan, status_jalan, panjang_jalan, koordinat) VALUES
('".$_POST['nama']."', '".$_POST['status']."', '".$_POST['panjang']."', '".$_POST['koordinat']."')";
mysqli_query($koneksi, $query);
?>
+14
View File
@@ -0,0 +1,14 @@
<?php
include "../config/koneksi.php";
$id = $_POST['id'];
$nama = $_POST['nama'];
$status = $_POST['status'];
$query = "UPDATE jalan SET nama_jalan='$nama', status_jalan='$status' WHERE id='$id'";
if(mysqli_query($koneksi, $query)) {
echo json_encode(['status' => 'success']);
} else {
echo json_encode(['status' => 'error']);
}
?>