File manager - Edit - /home/autoph/public_html/api/aha/load_my_car.php
Back
<?php include '../../../cfg/ahaconn.php'; $mykey = $_GET['keyID']; //echo "Arnel " . $mykey; if($mykey =="6e59e008b5348b452b615a3033729daae383"){ $userID = $_GET['userID']; $filter = $_GET['filter']; if($filter == '1'){ $myFilter = 'next_pms_date'; }else{ $myFilter = 'plateNo'; } // SQL query //$sql = "SELECT * FROM `vehicles` WHERE `aha_user_id` = '$userID' ORDER BY `id` ASC"; $sql = "SELECT vehicles.id AS vID, vehicles.aha_user_id AS ahaID, vehicles.brand_id AS bID, vehicles.model_id AS mID, vehicles.cs_number AS csNo, vehicles.year_model AS yrModel, vehicles.description AS carDesc, vehicles.vin_number AS carVIN, vehicles.carplus_alert AS carPlusAlert, vehicles.active_insurance as InsuranceStatus, vehicles.next_pms_date as nextPMSDate, vehicles.last_date_service as lastServiceDate, vehicles.color AS colorID, vehicles.plate_no AS plateNo, brands.id AS brandID, brands.name AS brandName, models.id AS modelID, models.name AS modelName, model_colors.id AS colorID, model_colors.color AS colorName FROM vehicles JOIN brands ON vehicles.brand_id = brands.id JOIN models ON models.id = vehicles.model_id JOIN model_colors ON model_colors.id = vehicles.color WHERE vehicles.enabled = 1 AND `aha_user_id` = '$userID' GROUP BY vehicles.plate_no ORDER BY next_pms_date ASC"; $result = $conn->query($sql); $count=0; if ($result->num_rows > 0) { // Array to hold the results $rows = array(); // Fetch data from each row and add it to the array while($row = $result->fetch_assoc()) { $rows[] = $row; $count = $count + 1; } if($count > 1){ $prefix ='s'; }else{ $prefix =''; } $stat = "You have ". $count . " registered vehicle".$prefix." in your account. "; // Output the result in JSON format header('Content-Type: application/json'); echo json_encode([$rows,"Count" => "$count","status" => "$stat"]); } else { $stat = "There is no vehicle registered under this account. Click Add Car button to register your vehicle."; echo json_encode([$rows,"Count" => "$count","status" => "$stat"]); } } // Close connection $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings