Файл: liwar.ru/forum/m_new.php
Строк: 34
<?php
include_once 'Yadro/PDO_connect.php';
$set = DB::$dbs->queryFetch("SELECT * FROM `set_modul`");
if($set['forum']==0){header('location:../');}
if(!isset($cms->us['id'])){header('location:/error.php?user');}
verh('Новые сообщения');
include 'Yadro/Functions.php';
$num = 10;
$posts = DB::$dbs->querySingle("SELECT count(id) from `forum_post` where `time` > ?",array(time()-3600));
$total = intval(($posts - 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;
echo '<div class="munus">
<div class="zag">Всего сообщений: <b>'.$posts.'</b></div>';
$post = DB::$dbs->query("SELECT * FROM `forum_post` where `time` > ? order by `time` desc limit $start,$num",array((time()-3600)));
while($p = $post -> fetch()){
$cp = DB::$dbs->querySingle("SELECT count(id) from `forum_post` where `thema` = ?",array($p['thema']));
$podrazd = DB::$dbs->queryFetch("SELECT * FROM `forum_podrazd` where `id` = ? limit 1",array(abs(intval($p['podrazd']))));
$razd = DB::$dbs->queryFetch("SELECT * FROM `forum_razd` where `id` = ? limit 1",array(abs(intval($p['razd']))));
$thema = DB::$dbs->queryFetch("SELECT * FROM `forum_themes` where `id` = ? limit 1",array(abs(intval($p['thema']))));
echo '<div class="news">
Раздел: <a href="/forum/razd'.$razd['id'].'">'.$razd['name'].'</a><br>
Подраздел: <a href="/forum/podrazd'.$podrazd['id'].'">'.$podrazd['name'].'</a><br>
Тема: <a href="/forum/thema'.$thema['id'].'">'.$thema['name'].'</a> ('.$cp.') <a href="/forum/thema'.$thema['id'].'/page'.ceil($cp/10).'">>></a><br>
Сообщение: '.$func->uNick($p['user']).': '.$func->text($p['message']).' ('.t($p['time']).')<br>
</div>';
}
$func->page('/forum/m_new.php?');
echo '</div>';
niz();
?>