first commit

This commit is contained in:
2026-06-11 21:14:16 +07:00
parent b08a058a34
commit 027f1cc26b
28 changed files with 3428 additions and 0 deletions
+38
View File
@@ -0,0 +1,38 @@
<?php
include 'koneksi.php';
$nama = trim($_POST['nama'] ?? '');
$nomor = trim($_POST['no'] ?? '');
$status = trim($_POST['status'] ?? '');
$latitudeRaw = $_POST['lat'] ?? null;
$longitudeRaw = $_POST['lng'] ?? null;
$latitude = is_numeric($latitudeRaw) ? (float) $latitudeRaw : null;
$longitude = is_numeric($longitudeRaw) ? (float) $longitudeRaw : null;
$allowedStatus = ['24jam', 'tidak'];
if ($nama === '' || $nomor === '' || !in_array($status, $allowedStatus, true) || $latitude === null || $longitude === null) {
http_response_code(400);
exit('error');
}
$statement = mysqli_prepare(
$conn,
"INSERT INTO spbu (nama, no_spbu, status, latitude, longitude) VALUES (?, ?, ?, ?, ?)"
);
mysqli_stmt_bind_param($statement, "sssdd", $nama, $nomor, $status, $latitude, $longitude);
try {
if (mysqli_stmt_execute($statement)) {
echo 'success';
} else {
http_response_code(500);
echo 'error';
}
} catch (mysqli_sql_exception $exception) {
http_response_code(500);
echo 'error: ' . $exception->getMessage();
}
mysqli_stmt_close($statement);
?>