Файл: user/new_mess.php
Строк: 64
<?
require_once '../core/system.php';
$req = mysql_query("SELECT * from `ban` where `id_us` = '".$user['id']."' and `time`>'".$_SERVER['REQUEST_TIME']."'");
$ban = mysql_fetch_array($req);
if($ban['ban'] == 3){
header('Location: /moduls/ban');
}
if($ban['ban'] == 2){
header('Location: /');
$_SESSION['err'] = "Вы находитесь в бане!";
exit;
}
if(!isset($user['id'])) header('Location: /');
$header = 'Почта';
require_once '../core/head.php';
if($user['mesto'] != 'Почта') mysql_query("UPDATE `user` set `mesto` = 'Почта' where `id` = '".$user['id']."'");
if($user['save'] < 1){
header('Location: /');
}
$k_post = mysql_result(mysql_query("SELECT COUNT(*) FROM `users_konts` WHERE `id_user` = '".$user['id']."' AND `new_msg`"),0);
$k_page = k_page($k_post,10);
$page = page($k_page);
$start = 10*$page-10;
$q = mysql_query("SELECT * FROM `users_konts` WHERE `id_user` = '".$user['id']."' AND `new_msg` ORDER BY `new_msg` DESC LIMIT ".$start.", 10");
echo "<div class='player menuList'>";
if($k_post == 0)echo "<div class='foot'>
<span class='grey'>
Нет новых сообщений
</span>
</div>";
while ($post = mysql_fetch_array($q)){
$ank = mysql_fetch_array(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_array($mess);
if($ank['prava'] == 5){
$status = "<font color='ffc22b'>[A]</font>";
$tcolor = 'F7990D';
}
if($ank['prava'] == 4){
$status = "<font color='ffc22b'>[a]</font>";
$tcolor = 'EBC621';
}
if($ank['prava'] == 3){
$status = "<font color='ffc22b'>[M]</font>";
}
if($ank['prava'] == 2){
$status = "<font color='ffc22b'>[m]</font>";
}
echo "<li><a href='mail?id=".$ank['id']."'>";
echo online($ank['id']);
echo"<font color='".$ank['font']."'>".$ank['nick']."</font>";
if($ank['prava'] >=2 ){
echo $status;
}
echo", <span class='dgreen'>".vremja($msg['time'])."</span>";
if($ank['prava'] >= 4){
echo"<br>
<span class='white'>
".rez_text(($msg['msg']))."
</span>
</a>
</li>";
} else {
echo"<br>
<span class='white'>
".rez_text(antimat($msg['msg']))."
</span>
</a>
</li>";
}
echo "<div class=line'></div>";
}
echo "</div>
</font>";
if ($k_page > 1)str('?',$k_page,$page);
require_once '../core/foot.php';
?>