Файл: 4mast/profmas.ru/forums/new_thems.php
Строк: 17
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if($us['id'] == false){
header('location: /login/auth');
exit;
}
H ('Новые темы', '<a href="/forums" style="color:white;">Форум</a> | Новые темы');
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` WHERE (`date`>'" . ( time () - 86400 ) . "')");
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
if ($page < 1) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$start = $page * $items_per_page - $items_per_page;
if ($items==0) {
echo '<div class="list1">Новых тем нет..</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `forum_t` WHERE (`date`>'" . (time () - 86400) . "') ORDER BY `id` DESC LIMIT $start, $items_per_page");
while ($t = $query -> fetch()) {
$r = DB :: $dbs -> queryFetch ("SELECT * FROM `forum_r` WHERE (`id`='" . $t['id_r'] . "')");
$pr = DB :: $dbs -> queryFetch ("SELECT * FROM `forum_pr` WHERE (`id`='" . $t['id_pr']. "')");
$c_p = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`id_t`='" . $t['id'] . "') " . (isset ($us) ? ($us['level']>0 ? '' : 'AND (`status`='0')') : 'AND (`status`='0')'));
echo '<div class="list1">';
echo 'Раздел: <a href="/forums/' . $r['id'] . '">' . $r['name'] . '</a><br/>';
echo 'Подраздел: <a href="/forums/' . $r['id'] . '/' . $pr['id'] . '">' . $pr['name'] . '</a><br/>';
echo '<img src="/images/' . ($t['top']==1? 'prikrep' : ($t['type']==0 ? 'closed' : 'the')) . '.png" alt=""/> Тема: <a href="/forums/thema' . $t['id'] . '">' . $t['name'] . '</a> (' . $c_p.') <a href="/forums/thema' . $t['id'] . '/page' . ceil ( $c_p / 10 ) . '">>></a><br/>';
echo Nick ($t['us']) . '/' . Nick ($t['last']) . ' (' . datef ($t['time']) . ')';
echo '</div>';
}
echo '' . page ('/forums/new_thems') . '';
}
require_once('../includes/Footers.php');