Файл: user/newmsg.php
Строк: 40
<?
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]."'"),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 "<li><a href='mail.php?id=$ank[id]'>";
if ($ank['storona'] == '0') {?><img src="/images/icon/0.png" height="11" alt="a"/> <?php }
if ($ank['storona'] == '1') {?><img src="/images/icon/1.png" height="11" alt="d"/> <?php }
echo online($ank[id]);
$nick = ($ank['id'] == 2403) ? '<span style="color: red">'.$ank['nick'].'</span>' : $ank['nick'];
echo $nick;
echo ", <span class='dgreen'>".vremja($msg[time])."</span>";
echo "<br><span class='$color'>".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';
?>