Файл: 4mast/profmas.ru/forums/my_thems.php
Строк: 26
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
if($us['id'] == false){
header('location: /login/auth');
exit;
}
if (!isset ($_GET['id'])) {
header ('location: /');
exit;
}
$query = DB :: $dbs -> query ("SELECT * FROM `us` WHERE (`id`=?)", array ((int) $_GET['id']));
if ($query -> rowCount () == 0) {
header ('location: /');
exit;
}
$u = $query -> fetch ();
H ('Темы ' . $u['nick'], '<a href="/forum" style="color:white;">Форум</a> | Темы ' . Nick ($u['id']));
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_t` WHERE (`us`='" . $u['id'] . "') " . ($us['level']>0 ? '' : 'AND (`type`!='2')'));
$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;
echo '<div class="menu2">Вcего ' . endi ($items, array ('тема', 'темы', 'тем')) . '</div>';
if ($items == 0) {
echo '<div class="error">' . Nick ($u['id']) . ' не создавал тем на форуме!</div>';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `forum_t` WHERE (`us`='" . $u['id'] . "') " . ($us['level']>0 ? '' : 'AND (`type`!='2')') . " 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="lst">Раздел: <a href="/forums/' . $t['id_r'] . '">' . $r['name'] . '</a><br/>';
echo 'Подраздел: <a href="/forums/' . $t['id_r'] . '/' . $t['id_pr'] . '">' . $pr['name'] . '</a><br/>';
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="/forums/thema' . $t['id'] . '/page' . ceil ($c_p/10) . '">></a><br/>' . Nick ($t['us']) . '/' . Nick ($t['last']) . ' (' . datef ($t['time']) . ')<br/>';
$c_f = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `forum_f` WHERE (`id_t`= '" . $t['id'] . "')");
if ($c_f != 0) {
echo '<img src="/images/page_white_get.png" alt="" align="middle"/> Файлов: <a href="/forum/files' . $t['id'] . '">' . $c_f . '</a><br/>';
}
echo '</div>';
}
echo '<div class="lst">' . page ('/forums/my_thems' . $u['id']) . '</div>';
}
require_once('../includes/Footers.php');