File manager - Edit - /home/autoph/public_html/api/aha/service_History.php
Back
<?php // MySQL connection parameters $servername = "localhost"; $username = "autoph_admindb"; $password = "~cxk)gU^ziaB"; $database = "autoph_ahg_crm"; // Create connection $conn = new mysqli($servername, $username, $password, $database); // Check connection if ($conn->connect_error) { die("Connection failed: " . $conn->connect_error); } $mykey = $_GET['keyID']; ; if($mykey =="token6e59e008b5348b452b615a3033729daae383-servicehistory"){ $userID = $_GET['userID']; $plate_number = $_GET['plate_number']; $sql = "SELECT t1.id AS serviceID,t1.aha_user_id,t1.vehicle_id,t1.car_plate,t1.date,t2.name AS ServiceName,t3.name AS DealerName, t3.id, t4.id AS StatusID, t4.name AS StatusName FROM service_bookings t1 JOIN service_types t2 ON t1.service_type_id = t2.id JOIN dealerships t3 ON t1.dealer_id = t3.id LEFT JOIN service_status t4 ON t1.service_status_id = t4.id WHERE car_plate='$plate_number' AND aha_user_id=t1.aha_user_id AND t4.id IS NOT NULL"; $count = 0; $result = $conn->query($sql); 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()) { if($row['read_by_user']==0){ $count= $count + 1; } if($count > 0){ $isVisible = 'true'; }else{ $isVisible = ''; } $rows[] = $row; } // Output the result in JSON format header('Content-Type: application/json'); echo json_encode([$rows,"Count" => "$count"]); //echo json_encode(["Count" => "$count","dashBoardView" => "$isVisible"]); } } $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings