first commit
This commit is contained in:
31
backend/Admin/driver/updateDriverFromAdmin.php
Executable file
31
backend/Admin/driver/updateDriverFromAdmin.php
Executable file
@@ -0,0 +1,31 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../connect.php';
|
||||
|
||||
$driver_id = filterRequest("id");
|
||||
$phone = filterRequest("phone");
|
||||
|
||||
// تشفير رقم الهاتف
|
||||
$encphone = $encryptionHelper->encryptData($phone);
|
||||
|
||||
$sql = "UPDATE `driver` SET `phone` = :encphone WHERE `id` = :id";
|
||||
$stmt = $con->prepare($sql);
|
||||
|
||||
// Bind values
|
||||
$stmt->bindParam(':encphone', $encphone, PDO::PARAM_STR);
|
||||
$stmt->bindParam(':id', $driver_id, PDO::PARAM_STR);
|
||||
|
||||
try {
|
||||
$stmt->execute();
|
||||
|
||||
if ($stmt->rowCount() > 0) {
|
||||
// تم التحديث بنجاح
|
||||
logAudit($con, $user_id, "تعديل رقم هاتف سائق", "driver", $driver_id, ["phone" => $phone]);
|
||||
jsonSuccess(null, "Phone updated successfully.");
|
||||
} else {
|
||||
// لم يتم العثور على أي سجل للتحديث
|
||||
jsonError("No records updated. Please check the driver ID.");
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
jsonError("Error updating record: " . $e->getMessage());
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user