29 lines
695 B
PHP
29 lines
695 B
PHP
<?php
|
|
require_once __DIR__ . '/../../connect.php';
|
|
|
|
$id = filterRequest("id");
|
|
$email = filterRequest("email");
|
|
|
|
// التحقق من وجود البيانات
|
|
if (empty($id) || empty($email)) {
|
|
jsonError("Missing required parameters");
|
|
exit;
|
|
}
|
|
|
|
// تشفير الإيميل
|
|
$encryptedEmail = $encryptionHelper->encryptData($email);
|
|
|
|
// تنفيذ التحديث
|
|
$sql = "UPDATE driver SET email = :email WHERE id = :id";
|
|
$stmt = $con->prepare($sql);
|
|
$success = $stmt->execute([
|
|
":email" => $encryptedEmail,
|
|
":id" => $id
|
|
]);
|
|
|
|
if ($success && $stmt->rowCount() > 0) {
|
|
jsonSuccess(null, "Email updated successfully");
|
|
} else {
|
|
jsonError("Failed to update email");
|
|
}
|
|
?>
|