46 lines
979 B
PHP
Executable File
46 lines
979 B
PHP
Executable File
<?php
|
|
|
|
require_once __DIR__ . '/../../connect.php';
|
|
|
|
$phone = filterRequest("phone");
|
|
|
|
// Encrypt phone
|
|
$encphone = $encryptionHelper->encryptData($phone);
|
|
|
|
$sql = "SELECT
|
|
*
|
|
FROM
|
|
`driver`
|
|
WHERE
|
|
phone = :encPhone";
|
|
|
|
$stmt = $con->prepare($sql);
|
|
|
|
// FIX 1: Bind AFTER preparing the statement
|
|
// FIX 2: Use the same placeholder name (:encPhone)
|
|
$stmt->bindParam(':encPhone', $encphone, PDO::PARAM_STR);
|
|
|
|
$stmt->execute();
|
|
|
|
if ($stmt->rowCount() > 0) {
|
|
|
|
$rows = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
|
|
// Decrypt sensitive fields
|
|
foreach ($rows as &$row) {
|
|
if (!empty($row['phone'])) {
|
|
$row['phone'] = $encryptionHelper->decryptData($row['phone']);
|
|
}
|
|
if (!empty($row['name_arabic'])) {
|
|
$row['name_arabic'] = $encryptionHelper->decryptData($row['name_arabic']);
|
|
}
|
|
}
|
|
|
|
jsonSuccess($rows);
|
|
|
|
} else {
|
|
jsonError("No recent driver location activity found");
|
|
}
|
|
|
|
?>
|