Add SportPath auth APIs and training content foundation

This commit is contained in:
Hamza-Ayed
2026-10-04 00:49:48 +03:00
parent e7f3c777d1
commit 5b90da6b18
23 changed files with 1451 additions and 238 deletions
+25
View File
@@ -0,0 +1,25 @@
<?php
declare(strict_types=1);
require_once dirname(__DIR__, 4) . '/backend/Config.php';
require_once dirname(__DIR__, 4) . '/backend/Database.php';
function api_json(array $payload, int $status = 200): void
{
http_response_code($status);
header('Content-Type: application/json; charset=utf-8');
header('Cache-Control: no-store');
header('X-Content-Type-Options: nosniff');
header('Referrer-Policy: no-referrer');
header('X-Frame-Options: DENY');
echo json_encode($payload, JSON_UNESCAPED_UNICODE | JSON_UNESCAPED_SLASHES);
exit;
}
function api_method(string $expected): void
{
if (($_SERVER['REQUEST_METHOD'] ?? 'GET') !== $expected) {
header('Allow: ' . $expected);
api_json(['error' => 'method_not_allowed'], 405);
}
}