Upload files to "api"

This commit is contained in:
2026-06-05 13:02:20 +00:00
parent 6f09b98d99
commit 1015a538c0
4 changed files with 281 additions and 292 deletions
+11 -3
View File
@@ -13,11 +13,19 @@ if ($_SERVER['REQUEST_METHOD'] === 'OPTIONS') {
}
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
$data = json_decode(file_get_contents('php://input'), true);
$rawData = file_get_contents('php://input');
$data = json_decode($rawData, true);
if (!isset($data['email']) || !isset($data['password'])) {
if (!$data) {
$data = $_POST;
}
if (empty($data['email']) || empty($data['password'])) {
http_response_code(400);
die(json_encode(['error' => 'Email and password are required']));
die(json_encode([
'error' => 'Email and password are required',
'debug' => ['raw' => $rawData, 'post' => $_POST]
]));
}
$result = loginUser($data['email'], $data['password']);