-
Notifications
You must be signed in to change notification settings - Fork 1
/
Copy pathmessages.php
32 lines (27 loc) · 945 Bytes
/
messages.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
<?php include "access_check.php"; ?>
<?php
session_start();
if(isset($_SESSION['pid'])) #checking if session already exists
{
if(isset($_GET['gid'])) {$gid=$_GET['gid'];}
$comments=mysqli_query($conn, "SELECT msg_id, p.pid, player_name, place, msg, DATE_FORMAT(timestamp, '%l:%i %p') FROM comments c , players p where p.pid=c.pid and gid=$gid and c.status=2 order by timestamp desc;");
if(mysqli_num_rows($comments) > 0)
{
while($comment=mysqli_fetch_row($comments))
{
$msg_id=$comment[0];
$player_id=$comment[1];
$player_name=$comment[2];
$place=$comment[3];
$msg=$comment[4];
$time=$comment[5];
echo "<span style='color:#0088cc;'>$player_name, $place:</span><div style='color:#000000;'>$msg <i style='font-size:8px;'>$time</i></div>";
echo "<hr class='dotted short'>";
}
}
else
{
echo "<strong>Be the first to write a message!</strong>";
}
}
?>