<?php
require_once __DIR__.'/../config/config.php';
require_once __DIR__.'/../config/database.php';
require_once __DIR__.'/../includes/functions.php';
header('Content-Type: application/json; charset=UTF-8');
header('X-Content-Type-Options: nosniff');
if($_SERVER['REQUEST_METHOD']==='OPTIONS'){http_response_code(204);exit;}

header('Referrer-Policy: strict-origin-when-cross-origin');
header('Permissions-Policy: camera=(self), microphone=(), geolocation=()');
header('Cache-Control: no-store, max-age=0');

if (function_exists('afStage24LogApiShutdown')) {
    $GLOBALS['af_stage24_api_started'] = microtime(true);
    register_shutdown_function(static function () use ($pdo): void {
        if ($pdo instanceof PDO) afStage24LogApiShutdown($pdo);
    });
}
