<?php
#Виджет сообщений из чата

$k_post = mysql_result(mysql_query("SELECT COUNT(id) FROM `mini_chat`"), 0);
$k_page = k_page($k_post, $set['p_str']);
$page = page($k_page);
$start = $set['p_str'] * $page - $set['p_str'];
$limit = $user['set_chat_str'];
$q = mysql_query("SELECT * FROM `mini_chat` ORDER BY id DESC LIMIT $limit");

echo "<div class='list-group-item-null'>\n";
if (mysql_num_rows($q) != 0) {

    while ($post = mysql_fetch_assoc($q)) {
        if ($post['id_user'] == 0) {
            $ank['id'] = 0;
            $ank['pol'] = 'guest';
            $ank['level'] = 0;
        } else {
            $ank = get_user($post['id_user']);
        }

        echo "<a href='/id$ank[id]'><b><font color='#4C6B8F'>$ank[nick]</font></b></a> ";
        echo '<small style="color: grey;">' . date::times($post['time']) . '</small><br />';

        echo toOutput(utf8_substr($post['msg'], 200)) . "\n";
        echo "<hr>";
    }
} else {
    echo "<small style='color: grey;'>" . lang('Начните беседу') . "...</small>";
}
?>
<form method='post' action='/modules/mini_chat/?<?= $passgen ?>'>
    <div class="input-group">
        <input type="text" class="form-control" name='msgs' placeholder="Введите сообщение...">
        <span class="input-group-btn">
            <button class="btn btn-secondary">Отправить</button>
        </span>
    </div>
</form>
</div>
























