From 13b8b4cc7f1444a7f93c57caf8a14f74979dcf8c Mon Sep 17 00:00:00 2001 From: Hamza-Ayed Date: Sun, 10 May 2026 00:59:49 +0300 Subject: [PATCH] add new featurs like realtime 2026-5-10-9 --- Admin/driver/updateDriverFromAdmin.php | 1 + functions.php | 20 +++++++++++++++++++- ride/kazan/update.php | 4 +++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/Admin/driver/updateDriverFromAdmin.php b/Admin/driver/updateDriverFromAdmin.php index d12bf2c..d04a1c1 100755 --- a/Admin/driver/updateDriverFromAdmin.php +++ b/Admin/driver/updateDriverFromAdmin.php @@ -19,6 +19,7 @@ try { if ($stmt->rowCount() > 0) { // تم التحديث بنجاح + logAudit($con, $user_id, "تعديل رقم هاتف سائق", "driver", $driver_id, ["phone" => $phone]); jsonSuccess(null, "Phone updated successfully."); } else { // لم يتم العثور على أي سجل للتحديث diff --git a/functions.php b/functions.php index 85ae300..12c7190 100755 --- a/functions.php +++ b/functions.php @@ -460,4 +460,22 @@ function sendFCM_Internal( - +function logAudit($con, $adminId, $action, $tableName = null, $recordId = null, $details = null) { + try { + $stmt = $con->prepare(" + INSERT INTO `admin_audit_log` (`admin_id`, `action`, `table_name`, `record_id`, `details`) + VALUES (:admin_id, :action, :table_name, :record_id, :details) + "); + $stmt->execute([ + ':admin_id' => $adminId, + ':action' => $action, + ':table_name' => $tableName, + ':record_id' => $recordId, + ':details' => is_array($details) ? json_encode($details, JSON_UNESCAPED_UNICODE) : $details + ]); + return true; + } catch (Exception $e) { + error_log("Audit Log Error: " . $e->getMessage()); + return false; + } +} diff --git a/ride/kazan/update.php b/ride/kazan/update.php index eccda75..6994628 100644 --- a/ride/kazan/update.php +++ b/ride/kazan/update.php @@ -31,9 +31,11 @@ $stmt = $con->prepare($sql); $stmt->execute($params); if ($stmt->rowCount() > 0) { + // تسجيل العملية في السجل + logAudit($con, $user_id, "تحديث عمولة/أسعار النظام (Kazan)", "kazan", $id, $params); jsonSuccess(null, "Kazan data updated successfully"); } else { - // If no rows were changed but execute was successful, it might be because the data is the same + // تسجيل محاولة التحديث حتى لو لم تتغير القيم (اختياري) jsonSuccess(null, "Kazan data remains unchanged or updated"); } ?> \ No newline at end of file