Файл: 4mast/profmas.ru/forums/nep.php
Строк: 19
<?
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if($us['id'] == false){
header('location: /login/auth');
exit;
}
H ('Непрочитанное', '<a href="/forum" style="color:white;">Форум</a> | Непрочитанное');
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` LEFT JOIN `forum_visit` ON `forum_t`.`id`=`forum_visit`.`id_t` AND `forum_visit`.`us`='" . $us['id'] . "' WHERE `forum_t`.`type` != '2' AND (`forum_visit`.`id_t` IS NULL)");
echo '<div class="menu2">Всего <b>' . $items . '</b> непрочитанных тем</div>';
$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="error">Непрочитанных тем пока нет..</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT `forum_t`.* FROM `forum_t` LEFT JOIN `forum_visit` ON `forum_t`.`id`=`forum_visit`.`id_t` AND `forum_visit`.`us`='" . $us['id'] . "' WHERE `forum_t`.`type` != '2' AND (`forum_visit`.`id_t` IS NULL) 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'] . "') " . ($us['level']>0 ? '' : 'AND (`status` = '0')'));
echo '<div class="list1">
Раздел: <a href="/forum/razd' . $r['id'] . '">' . $r['name'] . '</a><br/>
Подраздел: <a href="/forum/' . $r['id'] . '/' . $pr['id'] . '">' . $pr['name'] . '</a><br/>
<img src="/images/' . ($t['top']==1 ? 'prikrep' : ($t['type']==0 ? 'closed' : 'the')) . '.png" alt=""/> <a href="/forum/thema' . $t['id'] . '">' . $t['name'] . '</a> (' . $c_p . ') <a href="/forums/thema' . $t['id'] . '/page' . ceil ( $c_p / 10 ) .'">></a><br/>
' . Nick ( $t['us'] ) . ' / ' . Nick ( $t['last'] ) . ' (' . datef ($t['time']) . ')
</div>
';
}
echo '<div class="navg">' . page ('/forums/nep') . '</div>';
}
require_once('../includes/Footers.php');
?>