<?
require_once '../core/system.php';
require_once '../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `users_konts` WHERE `id_user` = '".$user[id]."'"),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 `users_konts` WHERE `id_user` = '".$user[id]."' ORDER BY `time` DESC LIMIT $start, $set[p_str]");
if($k_post == 0)echo "<div class='player grey'>Нет контактов!</div>";
echo "<div class='player menuList'>";
while ($post = mysql_fetch_assoc($q)){
$ank = mysql_fetch_assoc(mysql_query("SELECT * FROM `user` WHERE `id` = $post[id_kont] LIMIT 1"));
$mess = mysql_query("SELECT * FROM `mail` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank[id]' OR `id_user` = '$ank[id]' AND `id_kont` = '$user[id]' ORDER BY id DESC LIMIT 1");
$msg = mysql_fetch_assoc($mess);
if($msg[read] == 1)$color = 'white';
if($msg[read] == 0)$color = 'grey';
echo "<div class='link-div-otstup'><a href='mail.php?id=$ank[id]' class='link-block-menu'>";
echo online($ank[id]);
echo $ank[nick];
echo "<br/><span class='poyasnenie-yellow'><span class='$color'>".rez_text($msg[msg])."</span></span></a></li>";
echo "<div class=dot-line'></div>";
}
echo "</div>";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
require_once '../core/foot.php';
?>