42 lines
1017 B
PHP
42 lines
1017 B
PHP
<?php
|
|
|
|
include "../connect.php";
|
|
|
|
$email = filterRequest('email');
|
|
$id = filterRequest('id');
|
|
|
|
$sql = "SELECT
|
|
*,
|
|
phone_verification_passenger.verified
|
|
FROM
|
|
passengers
|
|
LEFT JOIN phone_verification_passenger ON phone_verification_passenger.phone_number = passengers.phone
|
|
WHERE
|
|
passengers.email =:email AND passengers.id = :id AND phone_verification_passenger.verified='1'
|
|
";
|
|
$stmt = $con->prepare($sql);
|
|
$stmt->bindParam(':email', $email);
|
|
$stmt->bindParam(':id', $id);
|
|
$stmt->execute();
|
|
$data = $stmt->fetchAll(PDO::FETCH_ASSOC);
|
|
$count = $stmt->rowCount();
|
|
|
|
header('Content-Type: application/json'); // Ensure the response is JSON
|
|
|
|
if ($count > 0) {
|
|
echo json_encode([
|
|
"status" => "success",
|
|
"count" => $count,
|
|
"data" => $data
|
|
]);
|
|
} else {
|
|
echo json_encode([
|
|
"status" => "Failure",
|
|
"data" => "User does not exist."
|
|
]);
|
|
}
|
|
|
|
$stmt = null; // Close the statement
|
|
$con = null; // Close the connection
|
|
exit(); // Ensure no further output
|