first commit
This commit is contained in:
49
backend/auth/syria/driver/driver_details.php
Executable file
49
backend/auth/syria/driver/driver_details.php
Executable file
@@ -0,0 +1,49 @@
|
||||
<?php
|
||||
require_once __DIR__ . '/../../../connect.php';
|
||||
|
||||
$driverId = filterRequest("id");
|
||||
|
||||
if (empty($driverId)) {
|
||||
jsonError("driver_id is required.");
|
||||
exit;
|
||||
}
|
||||
|
||||
try {
|
||||
// تفاصيل السائق
|
||||
$sql = "SELECT * FROM driver WHERE id = :id LIMIT 1";
|
||||
$stmt = $con->prepare($sql);
|
||||
$stmt->execute([':id' => $driverId]);
|
||||
$driver = $stmt->fetch(PDO::FETCH_ASSOC);
|
||||
|
||||
if (!$driver) {
|
||||
jsonError("Driver not found.");
|
||||
exit;
|
||||
}
|
||||
|
||||
// فك التشفير للحقول الحساسة
|
||||
foreach ($driver as $k => $v) {
|
||||
if (in_array($k, ['phone',
|
||||
'email',
|
||||
'first_name',
|
||||
'last_name',
|
||||
'national_number',
|
||||
'address','gender','site',
|
||||
'birthdate',
|
||||
'name_arabic'])) {
|
||||
$driver[$k] = $encryptionHelper->decryptData($v);
|
||||
}
|
||||
}
|
||||
|
||||
// الوثائق
|
||||
$sql2 = "SELECT doc_type, image_name, link FROM driver_documents WHERE driverID = :id";
|
||||
$stmt2 = $con->prepare($sql2);
|
||||
$stmt2->execute([':id' => $driverId]);
|
||||
$docs = $stmt2->fetchAll(PDO::FETCH_ASSOC);
|
||||
|
||||
printSuccess([
|
||||
"driver" => $driver,
|
||||
"documents" => $docs
|
||||
]);
|
||||
} catch (PDOException $e) {
|
||||
jsonError("Error: " . $e->getMessage());
|
||||
}
|
||||
Reference in New Issue
Block a user