Вход Регистрация
Файл: 4mast/profmas.ru/forums/pth.php
Строк: 14
<?php


require_once('../includes/Headers.php');
require_once(
'../includes/PDO_func.php');

if(
$us['id'] == false){
header('location: /login/auth');
exit;
 } 

$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_podp` LEFT JOIN `forum_t` ON `forum_t`.`id`=`forum_podp`.`id_t` WHERE (`forum_podp`.`us`='" . $us['id'] . "') AND (`forum_t`.`type`!='2')");
H ('Наблюдаемые темы', 'Наблюдаемые темы (' . $items . ')');

$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 * FROM `forum_podp` LEFT JOIN `forum_t` ON `forum_t`.`id`=`forum_podp`.`id_t` WHERE (`forum_podp`.`us`='" . $us['id'] . "') AND (`forum_t`.`type`!='2') ORDER BY `forum_podp`.`id` DESC LIMIT $start, $items_per_page");
        while (
$podp = $query -> fetch()) {
            
                
$t   = DB :: $dbs -> queryFetch  ("SELECT * FROM `forum_t` WHERE (`id`='" . $podp['id_t'] . "')");
                
// 
                
$c_p = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_p` WHERE (`id_t`='" . $t['id'] . "') " . (isset ($us) ? ($us['level']>0 ? '' : 'AND (`del`='0')') : 'AND (`del`='0')'));
                
                echo 
'<div class="list1">';
                echo 
'<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="/forum/thema' . $t['id'] . '/page' . ceil ( $c_p / 10 ) . '">>></a><br/>';
                echo 
uNick ($t['us']) . '/' . uNick ($t['last']) . ' (' . datef ($t['time']) . ')';
                echo 
'</div>';

        }
        
        echo 
'<div class="lst">' . pages ('/forums/pth') . '</div>';
   
}


require_once(
'../includes/Footers.php');
Онлайн: 2
Реклама