Initial commit

This commit is contained in:
Your Name
2026-06-02 12:40:37 +07:00
commit 20607b0e75
117 changed files with 25598 additions and 0 deletions
+29
View File
@@ -0,0 +1,29 @@
<?php
header('Content-Type: application/json');
require_once 'config.php';
// Check authentication and authorization
requireRole(['Admin']);
if ($_SERVER['REQUEST_METHOD'] !== 'POST') {
http_response_code(405);
die(json_encode(['error' => 'Method not allowed']));
}
$data = json_decode(file_get_contents('php://input'), true);
// Validate input
if (!isset($data['username']) || !isset($data['email']) || !isset($data['password']) || !isset($data['role'])) {
http_response_code(400);
die(json_encode(['error' => 'Missing required fields: username, email, password, role']));
}
$result = createUser($data['username'], $data['email'], $data['password'], $data['role']);
if ($result['success']) {
http_response_code(201);
} else {
http_response_code(400);
}
die(json_encode($result));