Файл: modules/op/index.php
Строк: 54
<?php
include '../../system/core.php';
if(!$user['id']){
header('Location: /index.php'); exit;
}
switch($_GET['m']){
case 'clear':
$ops = mysql_result(mysql_query("SELECT COUNT(*) FROM `op` where `who` = '".$user['id']."'"),0);
mysql_query("DELETE FROM `op` WHERE `who`='".$user['id']."' limit $ops");
header('Location: /op'); exit;
break;
#Главная
default:
$_title = 'Оповещения';
include '../../system/header.php';
echo "<a href='/'><div class='logo'><img src='/images/cornerhat.png' class='snoww'><span style='font-family: drunkC; font-size:22px;'>$_title</span></div> </a>";
/////////////////////////////////////////////////
$rek = mysql_query("SELECT * FROM `ads` WHERE `mode` = '1'");
echo '<div class="rek"><div class="rekl"><img src="/images/r.png" alt="*"> <a href="/bl?bl=rek">Купить рекламу</a></br>';
while($rek2 = mysql_fetch_array($rek))
{
echo '<img src="/images/r.png" alt="*"> <a href="'.$rek2['link'].'">'.$rek2['name'].'</a></br>';
}
echo '</div>';
echo '</div>';
include 'system/nvg.php';
if($user['id']) {
echo ' <div class="start">';
echo '<div class="s" style="border-bottom:none;">';
echo '<table style="width:100%" cellspacing="0" cellpadding="0">';
echo '<tbody><tr><td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/cab" title="Кабинет"><img class="ico" align="middle" src="/images/vcard.png" alt="*"></a></center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center>';
echo '<a href="/privat/" title="Почта"><img class="ico" align="middle" src="/images/mail2.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `privat` where `ho` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo ' <b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '<td style="vertical-align:top;width:10%;">';
echo '<center><a href="/op/" title="Оповещения"><img class="ico" align="middle" src="/images/warning.png" alt="*"></a>';
if($user['id']){
$c = mysql_result(mysql_query('select count(`id`) from `op` where `who` = "'.$user['id'].'" and `read` = "0"'),0);
if($c != 0) echo '<b> (+'.$c.')</b>';
}
echo '</center></td>';
echo '</tr></tbody></table>';
echo '</div>';
}
//////////////////////////////////////////////////////
echo '<div class="start">';
echo '<div class="s"><div class="ss"><span><a href="/op?m=clear">Очистка</a><span></div></div>';
$cop = $user['on_page'];
$ca = mysql_result(mysql_query("SELECT COUNT(*) FROM `op` where `who` = '".$user['id']."'"),0);
$cp = ceil($ca/$cop);
if(isset($_GET['p']) && is_numeric($_GET['p'])){
$p = $_GET['p'];
if($_GET['p']>$cp) $p = $cp;
if($_GET['p']<1)$p = 1;
}else{
$p = 1;
}
$start = $p*$cop-$cop;
$op = mysql_query("SELECT * FROM `op` where `who` = '".$user['id']."' ORDER BY `id` DESC LIMIT $start,$cop");
while($op2 = mysql_fetch_assoc($op)){
$op2_ho = mysql_fetch_array(mysql_query('select * from `user` where `id` = '.$op2['ho'].''));
echo '<div class="post1"><a href="/us'.$op2['ho'].'">'.uname($op2_ho['id']).'</a> '.smiles(bbcode($op2['text'])).' ['.times($op2['time']).']';
if($op2['read'] == 0) echo ' <font color="red"><b>[new!]</b></font>';
echo '</div>';
mysql_query("UPDATE `op` SET `read`='1' WHERE `id`='".$op2['id']."' limit 1");
}
echo '<div class="levo">Стр. ';
if($p-2>0) echo '<a href="/op/p1"><<</a> ';
if($p-1>0) echo '<a href="/op/p'.($p-1).'"><</a> ';
if($p-3>0) echo '<a href="/op/p'.($p-3).'">'.($p-3).'</a> | ';
if($p-2>0) echo '<a href="/op/p'.($p-2).'">'.($p-2).'</a> | ';
if($p-1>0) echo '<a href="/op/p'.($p-1).'">'.($p-1).'</a> | ';
echo '<b>'.$p.'</b>';
if($p+1<=$cp) echo ' | <a href="/op/p'.($p+1).'">'.($p+1).'</a>';
if($p+2<=$cp) echo ' | <a href="/op/p'.($p+2).'">'.($p+2).'</a>';
if($p+3<=$cp) echo ' | <a href="/op/p'.($p+3).'">'.($p+3).'</a>';
if($p+1<=$cp) echo ' <a href="/op/p'.($p+1).'">></a>';
if($p+2<=$cp) echo ' <a href="/op/p'.ceil($ca/$cop).'">>></a>';
echo '</div></div>';
break;
}
include '../../system/footer.php';
?>