21
This commit is contained in:
@@ -33,22 +33,23 @@ try {
|
||||
appLog("✅ File moved successfully to: " . $uploadResult['path']);
|
||||
|
||||
// 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");
|
||||
|
||||
// تأكد من أن الاتصال قادم من connect.php أو اجلبه
|
||||
$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]);
|
||||
$count = $stmt->fetchColumn();
|
||||
|
||||
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);
|
||||
$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 {
|
||||
// إدخال جديد
|
||||
$insertSQL = "INSERT INTO imageProfileCaptain (driverID, image_name, link) VALUES (?, ?, ?)";
|
||||
|
||||
Reference in New Issue
Block a user