Files
Siro/walletintaleq.intaleq.xyz/v2/main/auth/token/update_driver_auth.php
2026-06-11 18:22:59 +03:00

39 lines
1.1 KiB
PHP
Executable File

<?php
include "../../jwtconnect.php";
$captainId = filterRequest('captain_id');
$newToken = filterRequest("token");
$fingerPrint = filterRequest("fingerPrint");
if (!$captainId || !$newToken || !$fingerPrint) {
echo json_encode([
"status" => "failure",
"message" => "Missing required fields"
]);
exit;
}
try {
// بدون أي تشفير: خزّن التوكن كما هو
$tokenPlain = $newToken;
$stmt = $con->prepare("UPDATE driverToken SET token = ?, fingerPrint = ?, updated_at = NOW() WHERE captain_id = ?");
$ok = $stmt->execute([$tokenPlain, $fingerPrint, $captainId]);
if ($ok && $stmt->rowCount() > 0) {
echo json_encode([
"status" => "success",
"message" => "Driver token updated successfully"
]);
} else {
echo json_encode([
"status" => "failure",
"message" => "Captain not found or no update performed"
]);
}
} catch (PDOException $e) {
echo json_encode([
"status" => "failure",
"message" => "Database error: " . $e->getMessage()
]);
}