31 lines
965 B
PHP
Executable File
31 lines
965 B
PHP
Executable File
<?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());
|
|
}
|
|
?>
|