refactor: migrate API scripts to a centralized directory and implement shared database configuration

This commit is contained in:
superbia-17
2026-06-12 23:54:55 +07:00
parent 4424a57a0d
commit 5f1da32298
4 changed files with 9 additions and 4 deletions
+19
View File
@@ -0,0 +1,19 @@
<?php
header('Content-Type: application/json');
require_once __DIR__ . '/config.php';
$conn = getDB();
$name = $_POST['name'];
$lat = $_POST['lat'];
$lng = $_POST['lng'];
$radius = $_POST['radius'];
$type = $_POST['type'];
$address = $_POST['address']; // Capture the address
$stmt = $conn->prepare("INSERT INTO worship_places (name, lat, lng, radius, type, address) VALUES (?, ?, ?, ?, ?, ?)");
$stmt->bind_param("ssdiss", $name, $lat, $lng, $radius, $type, $address);
if ($stmt->execute()) {
echo json_encode(["id" => $conn->insert_id]);
}
?>