Файл: waphero.ru/user/new_mess.php
Строк: 30
<?
require_once '../core/system.php';
$header = 'Почта';
require_once '../core/head.php';
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `users_konts` WHERE `id_user` = '".$user[id]."' AND `new_msg`"),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]."' AND `new_msg` ORDER BY `new_msg` DESC LIMIT $start, $set[p_str]");
echo "<div class='player menuList'>";
if($k_post == 0)echo "<span class='grey'>Нет новых сообщений!</span>";
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);
echo "<li><a href='mail.php?id=$ank[id]'>";
echo online($ank[id]);
echo $ank[nick];
echo ", <span class='dgreen'>".vremja($msg[time])."</span>";
echo "<br><span class='white'>".rez_text($msg[msg])."</span></a></li>";
echo "<div class=dot-line'></div>";
}
echo "</div>";
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
require_once '../core/foot.php';
?>