This commit is contained in:
Hamza-Ayed
2026-04-30 02:18:22 +03:00
parent 2266d28416
commit b301aff8cb

View File

@@ -33,22 +33,23 @@ try {
appLog("✅ File moved successfully to: " . $uploadResult['path']); appLog("✅ File moved successfully to: " . $uploadResult['path']);
// 3. تحديث قاعدة البيانات // 3. تحديث قاعدة البيانات
$linkImage = 'https://intaleq.xyz/portrate_captain_image/' . $new_filename; $linkImage = 'https://api.intaleq.xyz/intaleq_v3/portrate_captain_image/' . $new_filename;
$uploadDate = date("Y-m-d H:i:s"); $uploadDate = date("Y-m-d H:i:s");
// تأكد من أن الاتصال قادم من connect.php أو اجلبه // تأكد من أن الاتصال قادم من connect.php أو اجلبه
$con = Database::get('main'); $con = Database::get('main');
// التحقق من وجود السائق // التحقق من وجود السائق في جدول الصور الشخصية
$stmt = $con->prepare("SELECT COUNT(*) FROM card_images WHERE driverID = ?"); $stmt = $con->prepare("SELECT COUNT(*) FROM imageProfileCaptain WHERE driverID = ?");
$stmt->execute([$driverID]); $stmt->execute([$driverID]);
$count = $stmt->fetchColumn(); $count = $stmt->fetchColumn();
if ($count > 0) { if ($count > 0) {
// تحديث // تحديث
$updateSQL = "UPDATE card_images SET upload_date = ?, image_name = ?, link = ? WHERE driverID = ?"; $updateSQL = "UPDATE imageProfileCaptain SET image_name = ?, link = ? WHERE driverID = ?";
$updateStmt = $con->prepare($updateSQL); $updateStmt = $con->prepare($updateSQL);
$success = $updateStmt->execute([$uploadDate, $new_filename, $linkImage, $driverID]); // Note: imageProfileCaptain doesn't seem to have 'upload_date' in the original insert, but let's check if we should add it. Let's just update image_name and link as in the insert statement.
$success = $updateStmt->execute([$new_filename, $linkImage, $driverID]);
} else { } else {
// إدخال جديد // إدخال جديد
$insertSQL = "INSERT INTO imageProfileCaptain (driverID, image_name, link) VALUES (?, ?, ?)"; $insertSQL = "INSERT INTO imageProfileCaptain (driverID, image_name, link) VALUES (?, ?, ?)";