Файл: new_mess.php
Строк: 96
<?
include_once 'sys/includes/start.php';
include_once 'sys/includes/compress.php';
include_once 'sys/includes/sess.php';
include_once 'sys/includes/home.php';
include_once 'sys/includes/settings.php';
include_once 'sys/includes/db_connect.php';
include_once 'sys/includes/ipua.php';
include_once 'sys/includes/fnc.php';
include_once 'sys/includes/user.php';
only_reg();
$set['title']='Новые сообщения';
include_once 'sys/includes/header.php';
title();
auter();
$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' OR `users_konts`.`type` = 'favorite') AND `mail`.`read` = '0'"),0);
$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)
{
echo "<table style='width:100%' cellspacing='1' cellpadding='1'><tr>";
echo "<td class='err'>";
echo "<b>Нет новых сообщений!</b>";
echo "</td>";
echo "</tr></table>";
}else{
$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' OR `users_konts`.`type` = 'favorite') 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 "<table style='width:100%' cellspacing='1' cellpadding='1'><tr>";
echo "<td class='icon14' rowspan='2'>";
avatar_mini($ank['id']);
echo "</td>";
echo "<td class='p_t'><b>";
if ($ank)
{
echo "<a href='/mail.php?id=$ank[id]'>".($kont['name']?$kont['name']:$ank['nick'])."</a> ".online($ank['id'])." (+".$kont['count'].")";
}else{
echo "<a href='/mail.php?id=$ank[id]'>[DELETED] (+".$kont['count'].")";
}
echo "</b></td>";
echo "</tr>";
echo "<tr>";
echo "<td class='p_m'>";
echo "<img src='/s-klub/img/time.png'> ";
echo "<b>Отправлено: ".vremja($kont['last_time'])."</b><br />";
echo "</td>";
echo "</tr></table>";
}
}
if ($k_page>1)
{
str('?',$k_page,$page);
}
echo "<a href='/konts.php?$passgen'>";
echo "<div class='foot'>";
echo "<img src='/s-klub/img/kontakt.png'> ";
echo "<b>Список контактов</b>";
echo "</div>";
echo "</a>";
echo "<a href='/umenu.php'>";
echo "<div class='foot'>";
echo "<img src='/s-klub/img/set.png'> ";
echo "<b>Кабинет</b>";
echo "</div>";
echo "</a>";
include_once 'sys/includes/footer.php';
?>