Update: 2026-06-27 05:36:53

This commit is contained in:
Hamza-Ayed
2026-06-27 05:36:53 +03:00
parent 7497bdcfae
commit bf1416b2a7
7 changed files with 109 additions and 40 deletions

View File

@@ -48,10 +48,11 @@ try {
uploadLog("✅ File moved successfully to: " . $uploadResult['path']);
// 3. تحديث قاعدة البيانات ديناميكياً
// Use configured domain instead of Host header to prevent host header injection
$host = getenv('APP_DOMAIN') ?: 'api.siromove.com';
$protocol = 'https';
$linkImage = "$protocol://$host/siro/portrate_captain_image/" . $new_filename;
// Derive base URL dynamically from the actual request
$protocol = (!empty($_SERVER['HTTPS']) && $_SERVER['HTTPS'] !== 'off') ? 'https' : 'http';
$host = getenv('APP_DOMAIN') ?: ($_SERVER['HTTP_HOST'] ?? 'api.siromove.com');
$scriptDir = rtrim(dirname($_SERVER['SCRIPT_NAME']), '/');
$linkImage = "$protocol://$host$scriptDir/portrate_captain_image/" . $new_filename;
// تأكد من أن الاتصال قادم من connect.php أو اجلبه
$con = Database::get('main');