File manager - Edit - /home/autoph/public_html/api/aha/Count_NewCarPlusAlert.php
Back
<?php include '../../../cfg/ahaconn.php'; $mykey =$_GET['keyID']; //echo "Arnel " . $mykey; if($mykey =="6e59e008b5348b452b615a3033729daae383"){ $userID = $_GET['userID']; // SQL query $sql = "SELECT * FROM `aha_carplusalert` WHERE `enabled` = 1 AND `aha_user_id`='$userID' ORDER BY `read_by_user` ASC"; $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"]); } else { echo json_encode(["status" => "No record found."]); } } //UPDATE Alert Status to 1 if($mykey =="6e59e008b5348b452b615a3033729daae383Close"){ $userID = $_GET['userID']; // SQL query $sql = "UPDATE `aha_carplusalert` SET `read_by_user`=1 WHERE `aha_user_id`='$userID'"; if ($conn->query($sql) === TRUE) { echo json_encode(["status" => "CarPlus Alert has been updated"]); } } $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings