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) { // Generate HMAC using passenger ID $hmac = generateHmac($id, $secretKey); echo json_encode([ "status" => "success", "count" => $count, "data" => $data, "hmac" => $hmac // Add the generated HMAC here ]); } 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