feat: implement full authentication system and CRUD APIs for users, rumah ibadah, and penduduk miskin with database updates.

This commit is contained in:
Syariffullah
2026-06-11 08:10:42 +07:00
parent 5585c34c5c
commit b77d4f6869
48 changed files with 1439 additions and 1442 deletions
+10
View File
@@ -1,5 +1,7 @@
<?php
header('Content-Type: application/json');
require_once '../auth_helper.php';
requireAdminOrPengelola();
require_once '../db_connect.php';
$data = json_decode(file_get_contents('php://input'), true);
@@ -10,6 +12,14 @@ $tipe_bantuan = trim($data['tipe_bantuan'] ?? '');
$tanggal = trim($data['tanggal'] ?? '');
$keterangan = trim($data['keterangan'] ?? '');
if ($_SESSION['role'] === 'pengelola') {
if ($ibadah_id !== intval($_SESSION['ibadah_id'])) {
header('HTTP/1.1 403 Forbidden');
echo json_encode(['status' => 'error', 'message' => 'Forbidden: Anda tidak diizinkan membuat log untuk rumah ibadah lain.']);
exit;
}
}
if (!$miskin_id || !$ibadah_id || !$tipe_bantuan || !$tanggal) {
echo json_encode(['status' => 'error', 'message' => 'Data tidak lengkap']);
exit;