From 7093cf8861e59ae24c1e2c5009f875afd75e6955 Mon Sep 17 00:00:00 2001 From: lopar Date: Fri, 2 Mar 2018 11:29:28 +0200 Subject: [PATCH] =?UTF-8?q?=D0=A7=D0=B0=D1=82=20=D0=BD=D0=B0=20=D0=BA?= =?UTF-8?q?=D0=BE=D0=BB=D0=B5=D0=BD=D0=BA=D0=B5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- chat.php | 18 ++++++++++-------- 1 file changed, 10 insertions(+), 8 deletions(-) diff --git a/chat.php b/chat.php index e3bee77..87d1d39 100644 --- a/chat.php +++ b/chat.php @@ -12,18 +12,20 @@ if ($_SESSION['uid'] == null) { include_once "config.php"; include_once "functions.php"; -$chat = db::c()->query('SELECT * FROM `chat` ORDER BY `id` ASC LIMIT 50'); - -while ($message = $chat->fetch_assoc()) { - $d = new DateTime($message['msgdate']); - echo $d->format('H:i').": " . $message['msg']."
"; -} - - $msg = filter_input(INPUT_POST,'msg'); $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'); + +while ($message = $chat->fetch_assoc()) { + $d = new DateTime($message['msgdate']); + $m = htmlspecialchars($message['msg']); + echo $d->format('H:i').": " . $m."
"; +} + + ?>