File manager - Edit - /home/autoph/public_html/api/aha/AHA_clientAutohubMessaging.php
Back
<?php include '../../../cfg/ahaconn.php'; $mykey = $_GET['keyID']; //echo "Arnel " . $mykey; if($mykey =="6e59e008b5348b452bact615a3033729daae383"){ $userID = $_GET['userID']; $lName = $_GET['lName']; $fName = $_GET['fName']; $type = $_GET['type']; $dealCode = $_GET['dealCode']; $cencernTitle = $_GET['cencernTitle']; $fFName = substr($fName, 0, 1); $lLName = substr($lName, 0, 1); $myInitial =$fFName . "".$lLName; $messageTextT= $_GET['messageText']; $messageText = $conn->real_escape_string($messageTextT); //check if messagebox is not empty to save record if($messageText != ""){ //insert message $insMsg ="INSERT INTO aha_autohub_chat ( `chat_code`, `sender_id`, `receiver_id`, `concern_title`, `message_text`, `date_time`, `initial`) VALUES( '$userID', '$userID', '$dealCode', '$cencernTitle', '$messageText', '$myTimeStamp', '$myInitial')"; if ($conn->query($insMsg) === TRUE) { $stat="Thank you! We are delighted to serve you."; } else { $stat="Error, unable to save record. Please contact us via Live Chat Support. Thank you!"; } } // SQL query $sql = "SELECT * FROM aha_autohub_chat WHERE chat_code='$userID' AND `deleted` = 0 AND `concern_title`='$cencernTitle' AND `chat_code`='$userID' ORDER BY id ASC LIMIT 250"; $result = $conn->query($sql); $count=0; if ($result->num_rows > 0) { // Array to hold the results $rows = array(); while($row = $result->fetch_assoc()) { $senderID = $row['sender_id']; if($userID == $senderID){ $myClass = 'msgBoxRight'; $avatarCSS = "avatarRight"; }else{ $avatarCSS = "avatarLeft"; $myClass = 'msgBoxLeft'; } $rows[] = [$row,"myClass"=>"$myClass","avatarCSS"=>"$avatarCSS"]; $count = $count + 1; } // Output the result in JSON format header('Content-Type: application/json'); } else { $cardNotes = "No record found."; } echo json_encode([$rows,"status" => "$stat"]); } // Close connection $conn->close(); ?>
| ver. 1.4 |
.
| PHP 7.3.33 | Generation time: 0 |
proxy
|
phpinfo
|
Settings