Файл: user/mail/new.php
Строк: 82
<?
include_once '../../sys/inc/start.php';
include_once '../../sys/inc/compress.php';
include_once '../../sys/inc/sess.php';
include_once '../../sys/inc/home.php';
include_once '../../sys/inc/settings.php';
include_once '../../sys/inc/db_connect.php';
include_once '../../sys/inc/ipua.php';
include_once '../../sys/inc/fnc.php';
include_once '../../sys/inc/user.php';
only_reg();
$set['title']='Новые сообщения';
include_once '../../sys/inc/thead.php';
title();
$k_post=mysql_result(mysql_query("SELECT COUNT(DISTINCT `mail`.`id_user`) FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common') AND `mail`.`read` = '0'"),0);
//echo mysql_error(),"<br />n";
$k_page=k_page($k_post,$set['p_str']);
$page=page($k_page);
$start=$set['p_str']*$page-$set['p_str'];
if ($k_post==0)msg("Нет новых сообщений");
$q=mysql_query("SELECT MAX(`mail`.`time`) AS `last_time`, COUNT(`mail`.`id`) AS `count`, `mail`.`id_user`, `users_konts`.`name` FROM `mail`
LEFT JOIN `users_konts` ON `mail`.`id_user` = `users_konts`.`id_kont` AND `users_konts`.`id_user` = '$user[id]'
WHERE `mail`.`id_kont` = '$user[id]' AND (`users_konts`.`type` IS NULL OR `users_konts`.`type` = 'common') AND `mail`.`read` = '0'
GROUP BY `mail`.`id_user` ORDER BY `count` DESC LIMIT $start, $set[p_str]");
while ($kont = mysql_fetch_assoc($q))
{
$ank=get_user($kont['id_user']);
echo "<a href='mail.php?id=$ank[id]'><div class='forum'>";
if ($ank['id']==0){
echo "$ank[nick] ".status($ank['id'])." ".medal($ank['id'])."";
} else
echo u($ank['id']);
echo "<font color='red'>(+$kont[count])</font>";
$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");
while ($post = mysql_fetch_assoc($mess)){
echo "<br/>".htmlspecialchars(rez_text2($post['msg']))." ....";
}
echo "</div></a>";
echo "</div></a>";
}
if ($k_page>1)str('?',$k_page,$page); // Вывод страниц
echo "<a href='index.php?$passgen'><div class='gmenu'><img src='/style/glavnaya.gif'> Контакты</div></a>";
include_once '../../sys/inc/tfoot.php';
?>