📁
SKYSHELL MANAGER-
🛒
PHP v7.4.33
Create Folder
Create File
Current Path:
home
/
oshofree
/
public_html
/
chbluxuries.com
/
chb_data
/
Name
Size
Permissions
Actions
📁
..
-
0755
🗑️
🔒
📄
config.php
7.06 KB
0444
🗑️
⬇️
✏️
🔒
📄
error_log
5335.01 KB
0644
🗑️
⬇️
✏️
🔒
Editing: chat.php
<?php include "admin_header.php"; $chatdate=date('Y-m-d H:i:s'); $chatid=$_SESSION['chat_id']; // get name $sql ="SELECT users.name FROM chat_session INNER JOIN users ON chat_session.user = users.id WHERE chat_session.chatid = '$chatid'"; $sql2 = mysqli_query($con,$sql); while($rowe = mysqli_fetch_array($sql2)){ $sender= $rowe['name'];} $insert = mysqli_query($con,"UPDATE chat_messages SET status='seen' where chatid='$chatid'") or die ('Could not connect: ' .mysqli_error($con)); ?> <script type="text/javascript" src="chat.js"></script> <div class="container-fluid"> <h1 class="h6 mb-4 text-gray-800"><?php echo $sender;?> (<?php echo $chatid;?>)</h1> <input type="text" value="<?php echo $name; ?>" id="ultimateuser" hidden> <script type="text/javascript"> $(document).ready(function() { var chatbox = document.getElementById("chatmessage"); // Use "chatmessage" as the ID chatbox.scrollTop = chatbox.scrollHeight; });</script> <div class="container" > <div class="chat-container" id="chatmessage"> <div class="row"> <div class="col-lg-12"> <ul class="list-unstyled"> <li class="d-flex justify-content-between mb-4" style="float:left; clear: left;"> <div class="card"> <div class="card-header d-flex justify-content-between p-3" style="background-color:#fff; "> <!----<p class="fw-bold mb-0">'.$sender.'</p>-----> <p class="text-muted small mb-0 ms-auto" ><i class="far fa-clock"></i> <?php echo $chatdate; ?></p> </div> <div class="card-body" style="background-color:'.$color.';"> <p class="mb-0"> Hello! thank you for contacting CHB luxury beauty supply store, How can I be of assistance? </p> </div> </div> </li> </div></div> <div id="chatmessages" class="mb-5"></div></ul></div> <?php $sqk = "SELECT * from chat_session where chatid='$chatid' ORDER BY s ASC"; $sqlp = mysqli_query($con,$sqk); while($rowe = mysqli_fetch_array($sqlp)) {$status = $rowe['status'];} if($status=="closed"){}else{ ?> </div> <div class="chatbox w-100"> <form action="" method="post" > <div class="input-group"> <input id="chat" value="<?php echo $chatid;?>" type="text" hidden /> <input id="user" value="<?php echo $name;?>" type="text" hidden /> <input type='text' id="message" class="form-control" placeholder="Type your message here..." name="meg" id="textAreaExample2" placeholder="Type a message" style="border:0; outline:none;" required /> <div class="input-group-addon"> <button type="button" value="select" name="select" id="butsave"><i class="fas fa-paper-plane"></i></button> </div> </div> </form> </div></div> <a href="#" class="float" data-toggle="modal" data-target="#modalEnd">X</a><?php } ?> <style> .input-group-addon{color:#ff0000; background-color: #ffffff;} textarea:focus { outline:none !important; border:none !important; } .chat-container { position: relative; width: 100%; margin:0; max-height: 100vh; /* Set a fixed height for the chat container or use a max-height */ overflow-y: scroll; /* Enable vertical scrolling if the content exceeds the container height */ overflow-x: hidden; /* Hide the horizontal scrollbar */ } .chatbox { position: sticky; bottom: 0; background-color: #fff; /* Set your desired background color */ padding: 10px; } #butsave { background: none; outline: none; border: none; color:#FF339A; font-size:20px; } .float{ position:fixed; width:60px; height:60px; bottom:70px; right:20px; background-color:#FF339A; color:#FFF; border-radius:50px; text-align:center; box-shadow: 2px 2px 3px #999; display: flex; justify-content: center; align-items: center; } .my-float{ font-size:24px; } .my-float:hover{ color:white !important; } .float:hover{ color:white !important; } </style> <!-- Logout Modal--> <div class="modal fade" id="modalEnd" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content" style="color:black;"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Ready to End Session?</h5> <button class="close" type="button" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <form method="post"> <div class="modal-body">Select "End Session" below if you are ready to end your current livechat.</div> <div class="modal-footer"> <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button> <input id="chat" value="<?php echo $chatid;?>" type="text" name="chat_id" hidden /> <button type="submit" class="btn btn-primary" value="end" name="endlive">End Session</button> </div></form> </div> </div> </div> <?php if(isset($_POST['endlive'])){ $chatid=$_POST['chat_id']; $insert = mysqli_query($con,"UPDATE chat_session SET status='closed' where chatid='$chatid'") or die ('Could not connect: ' .mysqli_error($con)); $date=date('Y-m-d H:i:s'); $message="Thank you for choosing CHBLUXURY BEAUTY. This chat has been closed"; $thealert = "New chat by customer($sender)"; checkAndUpdateNotification($thealert, $con); //Start Chat $submit = mysqli_query($con,"insert into chat_messages(`chatid`,`sender`,`message`, `date`, `type`, `status`) VALUES ('$chatid', '$name', '$message','$date','support','seen')") or die ('Could not connect: ' .mysqli_error($con)); $submit = mysqli_query($con,"INSERT INTO `alerts` (`action`, `date`) VALUES ('$name closed a chat with $sender','$date')") or die ('Could not connect: ' .mysqli_error($con)); echo "<script> alert('Live Chat Ended!');</script>"; header("refresh: 1; url=mychats.php");} ?> <!-- End of Main Content --> <div class="modal fade" id="selectStore" tabindex="-1"> <div class="modal-dialog modal-dialog-scrollable modal-dialog-centered"> <div class="modal-content"> <div class="modal-header"> <h6 style="color:black;">Select Store to View Stocks</h6> </div> <div class="modal-body"> <form id="form" name="form" action="store_input.php" method="post"> <div class="row mb-3"> <div class="col-md-12"> <select class="form-control" name="store" required> <option selected="selected" value="" >- Select Store -</option> <option value="" >All Stores</option> <?php $sql = "select s,name from chb_stores "; $sql2 = mysqli_query($con,$sql); while ($row = mysqli_fetch_array($sql2)) { echo'<option value="'.$row['s'].'">'.$row['name'].'</option>'; } ?></select> </div> <div class="modal-footer"> <input id="submit" name="submit" class="btn btn-sm btn-primary shadow-sm" type="submit" value="Select"> </div> </div></form> </div></div></div> </div><!-- End Modal Dialog Scrollable--> </div></div> </div><!-- End of Content Wrapper --> </div><!-- End of Page Wrapper --> <!-- Logout Modal--> <div class="modal fade" id="logoutModal" tabindex="-1" role="dialog" aria-labelledby="exampleModalLabel" aria-hidden="true"> <div class="modal-dialog" role="document"> <div class="modal-content" style="color:black;"> <div class="modal-header"> <h5 class="modal-title" id="exampleModalLabel">Ready to Leave?</h5> <button class="close" type="button" data-dismiss="modal" aria-label="Close"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body">Select "Logout" below if you are ready to end your current session.</div> <div class="modal-footer"> <button class="btn btn-secondary" type="button" data-dismiss="modal">Cancel</button> <a class="btn btn-primary" href="logout.php">Logout</a> </div> </div> </div> </div> <script src="https://code.jquery.com/jquery-3.6.0.min.js"></script> <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" /> <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script> <script src="vendor/bootstrap/js/bootstrap.bundle.min.js"></script> <script src="vendor/jquery-easing/jquery.easing.min.js"></script> <script src="js/sb-admin-2.min.js"></script> <script src="vendor/datatables/jquery.dataTables.min.js"></script> <script src="vendor/datatables/dataTables.bootstrap4.min.js"></script> <script src="js/demo/datatables-demo.js"></script> </body> </html>
💾 Save Changes