add config.php
This commit is contained in:
@@ -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'])) {
|
||||
|
||||
@@ -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_ibadah WHERE id = ?");
|
||||
|
||||
@@ -3,7 +3,8 @@ require_once '../../auth.php';
|
||||
requireRole('admin');
|
||||
|
||||
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);
|
||||
$stmt = $conn->prepare("DELETE FROM rumah_ibadah WHERE id = ?");
|
||||
$stmt->bind_param("i", $data['id']);
|
||||
|
||||
@@ -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_ibadah");
|
||||
$data = [];
|
||||
|
||||
@@ -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);
|
||||
$stmt = $conn->prepare("INSERT INTO rumah_ibadah (nama_ibadah, jenis, radius_m, lat, lng) VALUES (?, ?, ?, ?, ?)");
|
||||
$stmt->bind_param("ssidd", $data['nama_ibadah'], $data['jenis'], $data['radius_m'], $data['lat'], $data['lng']);
|
||||
|
||||
@@ -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'])) {
|
||||
|
||||
@@ -3,7 +3,8 @@ require_once '../../auth.php';
|
||||
requireRole('admin');
|
||||
|
||||
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 id, nama, username, role FROM users WHERE id = ?");
|
||||
|
||||
@@ -3,7 +3,8 @@ require_once '../../auth.php';
|
||||
requireRole('admin');
|
||||
|
||||
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);
|
||||
|
||||
$id = (int) $data['id'];
|
||||
|
||||
@@ -3,7 +3,8 @@ require_once '../../auth.php';
|
||||
requireRole('admin');
|
||||
|
||||
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'])) {
|
||||
|
||||
Reference in New Issue
Block a user