add config.php

This commit is contained in:
powji17
2026-06-10 21:06:57 +07:00
parent 3370977289
commit 5b7fe28614
17 changed files with 115 additions and 47 deletions
@@ -3,7 +3,8 @@ require_once '../../auth.php';
requireRole('admin', 'operator');
header('Content-Type: application/json');
$conn = new mysqli("localhost", "root", "", "webgis");
require_once '../../../config.php';
$conn = getDB();
$id = (int) $_GET['id'];
$stmt = $conn->prepare("SELECT * FROM rumah_prasejahtera WHERE id = ?");
@@ -3,8 +3,8 @@ require_once '../../auth.php';
requireRole('admin');
header('Content-Type: application/json');
// Pastikan nama database sudah benar
$conn = new mysqli("localhost", "root", "", "webgis");
require_once '../../../config.php';
$conn = getDB();
if ($conn->connect_error) {
echo json_encode(["status" => "error", "message" => "Koneksi database gagal"]);
@@ -1,6 +1,7 @@
<?php
header('Content-Type: application/json');
$conn = new mysqli('localhost', 'root', '', 'webgis');
require_once '../../../config.php';
$conn = getDB();
$result = $conn->query("SELECT * FROM rumah_prasejahtera");
$data = [];
while ($row = $result->fetch_assoc()) $data[] = $row;
@@ -3,7 +3,8 @@ require_once '../../auth.php';
requireRole('admin', 'operator');
header('Content-Type: application/json');
$conn = new mysqli("localhost", "root", "", "webgis");
require_once '../../../config.php';
$conn = getDB();
$data = json_decode(file_get_contents("php://input"), true);
@@ -3,7 +3,8 @@ require_once '../../auth.php';
requireRole('admin', 'operator');
header('Content-Type: application/json');
$conn = new mysqli("localhost", "root", "", "webgis");
require_once '../../../config.php';
$conn = getDB();
$data = json_decode(file_get_contents("php://input"), true);
if (!$data || !isset($data['id'])) {