-
Notifications
You must be signed in to change notification settings - Fork 1
/
showmessage.php
31 lines (30 loc) · 942 Bytes
/
showmessage.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
<?php
if(!isset($_SESSION["logged_in"]) || $_SESSION["logged_in"] == 0) {
echo "No Access";
exit();
}
$userid = $_SESSION['userid'];
$qstring = "SELECT recid, text, sendid, sendtime, name FROM message, users WHERE recid='$userid' AND users.id = message.sendid OR sendid='$userid' AND users.id = message.sendid ORDER BY sendtime DESC";
$qresult = mysqli_query($db, $qstring);
echo '<table border=2>';
echo '<tr>';
echo "<th> name </th>";
echo "<th> message </th>";
echo "<th> date </th>";
while ($row = mysqli_fetch_object($qresult)) {
if($row->sendid == $userid) {
echo '<tr bgcolor="#FFCCFF">';
echo "<th> $row->name </th>";
echo "<th> $row->text </th>";
echo "<th> $row->sendtime </th>";
echo'</tr>';
} else {
echo '<tr bgcolor="#CCFF99">';
echo "<th> $row->name </th>";
echo "<th> $row->text </th>";
echo "<th> $row->sendtime </th>";
echo'</tr>';
}
}
echo '</table>';
?>