Update: 2026-06-11 18:22:57
This commit is contained in:
39
walletintaleq.intaleq.xyz/v2/main/auth/token/update_driver_auth.php
Executable file
39
walletintaleq.intaleq.xyz/v2/main/auth/token/update_driver_auth.php
Executable file
@@ -0,0 +1,39 @@
|
||||
<?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()
|
||||
]);
|
||||
}
|
||||
46
walletintaleq.intaleq.xyz/v2/main/auth/token/update_passenger_token.php
Executable file
46
walletintaleq.intaleq.xyz/v2/main/auth/token/update_passenger_token.php
Executable file
@@ -0,0 +1,46 @@
|
||||
<?php
|
||||
require_once "../../jwtconnect.php"; // يحتوي $con و $encryptionHelper و filterRequest()
|
||||
|
||||
header('Content-Type: application/json; charset=utf-8');
|
||||
|
||||
$passengerId = filterRequest('passengerID');
|
||||
$newToken = filterRequest('token');
|
||||
$fingerPrint = filterRequest('fingerPrint');
|
||||
|
||||
if (!$passengerId || !$newToken || !$fingerPrint) {
|
||||
echo json_encode([
|
||||
"status" => "failure",
|
||||
"message" => "Missing required fields"
|
||||
]);
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// تشفير التوكن قبل التخزين
|
||||
// $tokenEncrypted = $encryptionHelper->encryptData($newToken);
|
||||
|
||||
// تحديث سجل الراكب
|
||||
$stmt = $con->prepare("
|
||||
UPDATE tokens
|
||||
SET token = ?, fingerPrint = ?
|
||||
WHERE passengerID = ?
|
||||
");
|
||||
$ok = $stmt->execute([$newToken, $fingerPrint, $passengerId]);
|
||||
|
||||
if ($ok && $stmt->rowCount() > 0) {
|
||||
echo json_encode([
|
||||
"status" => "success",
|
||||
"message" => "Passenger token updated successfully"
|
||||
]);
|
||||
} else {
|
||||
echo json_encode([
|
||||
"status" => "failure",
|
||||
"message" => "Passenger not found or no update performed"
|
||||
]);
|
||||
}
|
||||
} catch (PDOException $e) {
|
||||
echo json_encode([
|
||||
"status" => "failure",
|
||||
"message" => "Database error: " . $e->getMessage()
|
||||
]);
|
||||
}
|
||||
Reference in New Issue
Block a user