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
+35
View File
@@ -0,0 +1,35 @@
<?php
header('Content-Type: application/json');
require_once 'config.php';
// Handle CORS
header('Access-Control-Allow-Origin: *');
header('Access-Control-Allow-Methods: POST, GET, OPTIONS');
header('Access-Control-Allow-Headers: Content-Type');
if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
http_response_code(200);
exit();
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode(file_get_contents('php://input'), true);
if (!isset($data['email']) || !isset($data['password'])) {
http_response_code(400);
die(json_encode(['error' => 'Email and password are required']));
}
$result = loginUser($data['email'], $data['password']);
if ($result['success']) {
http_response_code(200);
} else {
http_response_code(401);
}
die(json_encode($result));
}
http_response_code(405);
die(json_encode(['error' => 'Method not allowed']));