Файл: pages/new_mess.php
Строк: 86
<?php
only_reg();
$set['title'] = 'Новые сообщения';
include_once 'sys/inc/thead.php';
title();
aut();
$k_post = db::count("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'");
$k_page = k_page( $k_post, $set['p_str'] );
$page = page( $k_page );
$start = $set['p_str'] * $page - $set['p_str'];
echo "<table class='post'>n";
if ( $k_post == 0 ) {
echo " <div class='mess'>n";
echo "Нет новых сообщенийn";
echo " </divn";
} else {
$q = db::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 = $q->fetch_assoc() ) {
$ank = get_user( $kont['id_user'] );
if ( $num == 0 ) {
echo " <div class='nav1'>n";
$num = 1;
} elseif ( $num == 1 ) {
echo " <div class='nav2'>n";
$num = 0;
}
if ( $ank )
echo status( $ank['id'] ) . group( $ank['id'] ) . " <a href='/info.php?id=$ank[id]'>" . ( $kont['name'] ? $kont['name'] : $ank['nick'] ) . "</a> " . medal( $ank['id'] ) . " " . online( $ank['id'] ) . " n";
else
echo "<a href='/mail.php?id=$ank[id]'>[DELETED] (+$kont[count])n";
echo "<font color='#1e00ff'>" . vremja( $kont['last_time'] ) . "</font><br />";
echo "<img src='/style/icons/new_mess.gif' alt='*' /> ";
echo "<a href='/mail.php?id=$ank[id]'>Сообщения</a> <font color='red'>+$kont[count]</font><br />n";
echo " </div>n";
}
}
echo "</table>n";
if ( $k_page > 1 )
str( '?', $k_page, $page );
echo "<div class='foot'>n";
echo "<img src='/style/icons/konts.png' alt='*' /> <a href='/konts.php'>Контакты</a><br />n";
echo "</div>n";
include_once 'sys/inc/tfoot.php';
?>