<?
require_once ('../system/func.php');
$set['p_str'] = 10;
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `chat`"),0);
$k_page = k_page($k_post,$set['p_str']);
$page = page($k_page);
$start = $set['p_str']*$page-$set['p_str'];
$q = mysql_query("SELECT * FROM `chat` ORDER BY `id` DESC LIMIT $start, $set[p_str]");
if($k_post == 0) echo "Сообщений не найдено...";
while($post = mysql_fetch_assoc($q)) {
echo "<div class='block'>";
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id` = $post[id_user] LIMIT 1"));
echo icons_user($ank[id])." <a href='/profile/$ank[id]'><font color='$ank[color]'>$ank[login]</font></a>, ".vremja($post['time'])." ";
if($myID != $ank['id'])echo "<a href='?to=$ank[id]'>[Отв]</a>";
$msg = str_replace(array($user[login].','), "<b>$user[login],</b> ", $post['text']);
echo "<br>".text_msg($msg);                                                                                 
if($user['access'] > 0)echo " <a href='?delete_post=$post[id]'><font color='red'>[×]</font></a>";
echo "</div>";
}
?>