-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathhtcont.php
41 lines (35 loc) · 1.05 KB
/
htcont.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<!-- Script for Adding HTML to Room Page -->
<?php
// Connection to Database
include 'db_connect.php';
// Setting the Variables
$room = $_POST['room'];
$res = "";
// Querying the Messages & Adding HTML
$sql = "SELECT msg, ip, stime FROM msgs WHERE room = '$room'";
$result = mysqli_query($conn, $sql);
if (mysqli_num_rows($result) > 0)
{
while ($row = mysqli_fetch_assoc($result))
{
$timevar = "";
if (substr($row['stime'], -8, -6) > 12)
{
$timevar .= (int)substr($row['stime'], -8, -6) - 12 . ":";
$ampm = "PM";
}
else
{
$timevar .= substr($row['stime'], -8, -6) . ":";
$ampm = "AM";
}
$timevar .= substr($row['stime'], -5, -3) . " " . $ampm;
$res = $res . '<div class="container-msg">';
$res = $res . '<p style="color: #999">';
$res = $res . $row['ip'];
$res = $res . ' ~</p> <p class="chat-msg">' . $row['msg'];
$res = $res . '</p> <span class="time-right">' . $timevar . '</span></div>';
}
}
echo $res;
?>