Файл: user/mail/index.php
Строк: 79
<?
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();
err();
$k_post=mysql_result(mysql_query("SELECT COUNT(*) FROM `users_konts` WHERE `id_user` = '$user[id]'"), 0);
if ($k_post){
$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, `new_msg` DESC LIMIT $start, $set[p_str]");
while ($post = mysql_fetch_array($q))
{
$ank_kont=get_user($post['id_kont']);
$out=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank_kont[id]'"), 0);
$in=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_user` = '$ank_kont[id]' AND `id_kont` = '$user[id]'"), 0);
$k_mess="$out/$in";
$k_new_mess=mysql_result(mysql_query("SELECT COUNT(*) FROM `mail` WHERE `id_user` = '$ank_kont[id]' AND `id_kont` = '$user[id]' AND `read` = '0'"), 0);
echo "<a href='mail.php?id=$ank_kont[id]'><div class='forum'>n";
echo u($ank_kont['id']);
echo ($k_new_mess!=0?'<b>':null)."(".($k_new_mess!=0?'+'.$k_new_mess:$k_mess).")".($k_new_mess!=0?'</b>':null);
$mess=mysql_query("SELECT * FROM `mail` WHERE `id_user` = '$user[id]' AND `id_kont` = '$ank_kont[id]' OR `id_user` = '$ank_kont[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>";
}
if ($k_page>1)str("?",$k_page,$page); // Вывод страниц
} else {
msg("Пока у вас нет ни одного контакта.<img src='/style/smiles/sad.gif'><br/>Найди новых друзей или даже свою любовь в наших <a href='/mods/dating'><font color='red'><b>Знакомствах</b></font></a>");
}
echo "<table>";
echo "<td class='block'><a href='/user/settings/mail.php'>Настройки</a></td>n";
echo "</table>";
include_once '../../sys/inc/tfoot.php';
?>