Файл: 4mast/profmas.ru/adm/fortr.php
Строк: 33
<?php
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
require_once('../codes/pagination.php');
if (!isset ($us)) {
header ('location: /');
exit;
}
if ($us['level']<1) {
header ('location:/');
exit;
}
H ('Админ форум', 'Админ форум');
$db = DB::$dbs;
$id = isset($_GET['id']) ? $db->quote($_GET['id']) : 1;
$phq='SELECT `id` FROM `adm_razd` WHERE `id` = '.$id;
echo ' <div class="block"><a href="/adm/fortnew.php?id='.htmlspecialchars($_GET['id']).'"><img src="/images/clean.png" alt=""/> Создать темку!</a></div>';
if ($db->query($phq)->rowCount() == 0)
{
?><div class="error">Директории нет</div><?php
require_once('../includes/Footers.php');
exit();
}
else
{
$pg = new Pagination;
$phq = 'SELECT `id`, `name` FROM `adm_fort` WHERE `ref` = '.$id;
if ($db -> query($phq)->rowCount() == 0)
{
?><div class="error">В данной категории тем нет!</div><?php
}
else
{
$pg -> init([
'page' => isset($_GET['page']) ? (int) $_GET['page'] : 1,
'num' => 10,
'posts' => $db->query($phq)->rowCount()
]);
$phq = 'SELECT `id`, `name` FROM `adm_fort` WHERE `ref` = '.$id.' ORDER BY `id` DESC LIMIT '.$pg->start.', '.$pg->num;
$query = $db->query($phq);
while ($row = $query -> fetch(PDO::FETCH_LAZY))
{
?><div class="block"><img src="/images/gnome-blog.png" alt=""/> <a href="/adm/forts.php?id=<?=$row->id?>"><?=$row->name?></a></div><?php
}
echo $pg->display('?id='.$id.'&page=');
}
}
require_once('../includes/Footers.php');
?>