Fifth Commit

This commit is contained in:
2026-06-13 12:01:09 +07:00
parent c150df3dc2
commit 899847d81c
12 changed files with 241 additions and 7 deletions
+11
View File
@@ -3,9 +3,20 @@
require_once __DIR__ . '/../config/db.php';
require_once __DIR__ . '/../config/helpers.php';
session_start();
if (!isset($_SESSION['user_id'])) {
jsonResponse(['error' => 'Unauthorized'], 401);
}
handlePreflight();
$method = getMethod();
if ($method !== 'GET') {
if (!isset($_SESSION['role']) || $_SESSION['role'] !== 'admin') {
jsonResponse(['error' => 'Forbidden: Admin access required'], 403);
}
}
$db = getDB();
switch ($method) {