Файл: BlogExl_v_3/modules/my/ops.php
Строк: 19
<?
if(!isset($user['id'])){header('location:/');}
head('Оповещения');
if(isset($_GET['reset'])){
$dbs->query("DELETE FROM `action` where `id_us` = '$user[id]'"); header('location:?');}
echo '<div class="post2"><a href="?&reset">Очистка</a></div>';
$ram = $dbs->query("SELECT * FROM `ops` where `id_us` = '$user[id]'")->num_rows;
$num = 10;
$total = intval(($ram - 1) / $num) + 1;
$page = abs(intval($_GET['page']));
if(empty($page) or $page < 0) $page = 1;
if($page > $total) $page = $total;
$start = $page * $num - $num;
$ops = $dbs->query("SELECT * FROM `action` where `id_us` = '$user[id]' order by `id` desc limit $start,$num");
if(!$ops->num_rows){echo'<div class="post2">Оповещений нет...</div>';}
while($op = $ops->fetch_assoc()){
if($op['read']==0){
$dbs->query("UPDATE `action` set `read` = '1' where `id` = '$op[id]' limit 1");}
echo '<div class="post2">'.$func->out($op['msg']).' ('.times($op['time']).')'.($op['read']==0?'<font color="red"><b>[new!]</b></font>':NULL).'</div>';
}
str('?&');
foot();
?>