Fix chat msg dublications

This commit is contained in:
lopar 2018-11-05 22:58:54 +02:00
parent e13e29c8ee
commit 7618c3d64c
1 changed files with 2 additions and 3 deletions

View File

@ -29,10 +29,9 @@ FROM `chat` ORDER BY `id` ASC LIMIT 50');
while ($message = $chat->fetch_assoc()) {
$d = new DateTime($message['msgdate']);
$m = htmlspecialchars($message['msg']);
if (!empty($message['type'])) {
if ($message['type'] == 'sys') {
echo sprintf('<span style="color:maroon">%s %s</span>', $d->format('H:i'),$m)." <br>";
}
echo sprintf('%s [%s]: %s', $d->format('H:i'),$message['from'],$m)." <br>";
} else echo sprintf('%s [%s]: %s', $d->format('H:i'),$message['from'],$m)." <br>";
}
}
show_messages();