File manager - Edit - /home/autoph/public_html/api/aha/add_new_car.php
Back
<?php include '../../../cfg/ahaconn.php'; $mykey = $_GET['keyID']; //echo "Arnel " . $mykey; if($mykey =="6e59e008b5348b452b615a3033729daae383"){ // SQL query $asaUserID = $_GET['userID']; $brandID = $_GET['brandID']; $modelID = $_GET['modelID']; $colorID = $_GET['colorID']; $transType = $_GET['transType']; $yearModel = $_GET['yearModel']; $plateNo = $_GET['plateNo']; $sqlOwnerID = "SELECT `id` AS ownerID FROM `customers` WHERE `aha_user_id`='$asaUserID'"; $resOwner = $conn->query($sqlOwnerID); if ($resOwner->num_rows > 0) { while($own = $resOwner->fetch_assoc()) { $ownerID = $own['ownerID']; } } $getDescription ="SELECT a.id AS brandID, a.name AS BrandName, b.id AS modelID, b.brand_id AS ModelBrandID, b.name AS modelName, c.id AS ColorID, c.model_id AS ColroModelID, c.color AS colorName, d.id AS transID, d.trans_name AS TransName FROM brands a INNER JOIN models b ON a.id = $brandID INNER JOIN model_colors c ON b.id = $modelID INNER JOIN aha_transmission_type d ON d.id = $transType WHERE c.id = $colorID LIMIT 1"; $carD = mysqli_query($conn,$getDescription); while($car = mysqli_fetch_array($carD)){ $carDesc = $car['BrandName'] . " " . $car['modelName'] . " " . $yearModel . " " .$car['TransName']; } //CHECK IF PLATE ALREAD EXIST $chk = "SELECT * FROM `vehicles` WHERE `enabled` = 1 AND `plate_no`='$plateNo' || `enabled`=1 AND`cs_number`='$plateNo'"; $chkCar = mysqli_query($conn,$chk); $chkCount = mysqli_num_rows($chkCar); if($chkCount > 0){ $stat="Record already exist. If you think this is an error, Please send us a message via Live Chat Support so we can assist you. Thank you!."; }else{ //SAVE AND ADD NEW VEHICLE RECORD $sql = "INSERT INTO vehicles (`aha_user_id`,`owner_id`,`brand_id`,`model_id`,`cs_number`,`plate_no`,`color`,`year_model`,`description`,`trans_type`) VALUES ('$asaUserID','$ownerID','$brandID','$modelID','TBD','$plateNo',' $colorID','$yearModel','$carDesc','$transType')"; if ($conn->query($sql) === TRUE) { $stat="Record has been saved."; } else { $stat="Error, unable to save record. Please contact us via Live Chat Support. Thank you!"; } } // Output the result in JSON format header('Content-Type: application/json'); echo json_encode(["status" =>$stat]); } // Close connection $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings