diff --git a/chat.php b/chat.php index 87d1d39..c4f0b2d 100644 --- a/chat.php +++ b/chat.php @@ -17,12 +17,13 @@ $uid = $_SESSION['uid']; if ($msg) db::c()->query('INSERT INTO `chat` (`cid`, `uid`, `msg`) VALUES (?i, ?i, "?s")', 1, $uid, $msg); -$chat = db::c()->query('SELECT * FROM `chat` ORDER BY `id` ASC LIMIT 50'); +$chat = db::c()->query('SELECT `msg`, `msgdate`, (SELECT `login` FROM `users` WHERE `users`.`id` = `uid`) AS `from` FROM `chat` ORDER BY `id` ASC LIMIT 50'); while ($message = $chat->fetch_assoc()) { $d = new DateTime($message['msgdate']); $m = htmlspecialchars($message['msg']); - echo $d->format('H:i').": " . $m."
"; +// echo $d->format('H:i').": " . $m."
"; + sprintf('$s [%s]: $s
', $d->format('H:i'),$message['from'],$m); } diff --git a/functions.php b/functions.php index 1597f04..08f1569 100644 --- a/functions.php +++ b/functions.php @@ -1467,6 +1467,10 @@ function getslot($i, $user1 = 0) } } +function nickname(){ + $s=1; +} + function nick($user) { $r = '';