Update: 2026-05-15 22:05:14

This commit is contained in:
Hamza-Ayed
2026-05-15 22:05:14 +03:00
parent fc4206cce8
commit eeee127292

View File

@@ -66,8 +66,10 @@ if (!$envLoaded) {
// Security: API Key Validation
$expectedApiKey = $_SERVER['API_KEY'] ?? (getenv('API_KEY') ?: ($_ENV['API_KEY'] ?? 'JORDAN_BOT_SECRET_2026'));
$headers = getallheaders();
$providedKey = $headers['X-API-Key'] ?? ($headers['x-api-key'] ?? null);
// Safe header extraction for NGINX/PHP-FPM
$headers = function_exists('getallheaders') ? getallheaders() : [];
$providedKey = $headers['X-API-Key'] ?? ($headers['x-api-key'] ?? $_SERVER['HTTP_X_API_KEY'] ?? null);
// Enhanced Debug Logging
error_log("JordanBot API Check: Provided: [$providedKey], Expected: [$expectedApiKey], EnvLoaded: [" . ($envLoaded ? "YES" : "NO") . "]");