first commit

This commit is contained in:
Hamza-Ayed
2026-06-09 08:40:31 +03:00
commit d8901e1a87
3161 changed files with 536187 additions and 0 deletions

View File

@@ -0,0 +1,45 @@
<?php
require_once __DIR__ . '/../../connect.php';
$phone = filterRequest("phone");
// 🔐 تشفير رقم الهاتف قبل البحث (لأنه مشفّر في قاعدة البيانات)
$phoneEncrypted = $encryptionHelper->encryptData($phone);
// 1⃣ جلب passengerID بناءً على رقم الهاتف
$sql = "SELECT `id` FROM `passengers` WHERE `phone` = :phone";
$stmt = $con->prepare($sql);
$stmt->bindParam(':phone', $phoneEncrypted);
$stmt->execute();
$data = $stmt->fetch(PDO::FETCH_ASSOC);
if ($data) {
$passengerID = $data['id'];
} else {
jsonError("No passenger found for the given phone number");
exit;
}
// 2⃣ جلب التوكنات المرتبطة بـ passengerID
$sql1 = "SELECT * FROM `tokens` WHERE `passengerID` = :passengerID";
$stmt = $con->prepare($sql1);
$stmt->bindParam(':passengerID', $passengerID);
$stmt->execute();
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
if ($data) {
// فك تشفير التوكن فقط
foreach ($data as &$row) {
$row['token'] = $encryptionHelper->decryptData($row['token']);
// fingerPrint يبقى كما هو
}
echo json_encode([
'status' => 'success',
'count' => count($data),
'data' => $data
]);
} else {
jsonError("No tokens found for the passenger");
}
?>