first commit
This commit is contained in:
29
backend/ride/profile/updateDriverEmail.php
Executable file
29
backend/ride/profile/updateDriverEmail.php
Executable file
@@ -0,0 +1,29 @@
|
||||
<?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");
|
||||
}
|
||||
?>
|
||||
Reference in New Issue
Block a user