Файл: 4mast/profmas.ru/codes/show_dir.php
Строк: 30
<?php
include 'pagination.php';
require_once('../includes/Headers.php');
require_once('../includes/PDO_func.php');
H ('Полезные куски кодов', 'Полезные куски кодов');
$db=DB::$dbs;
$phq='SELECT `id` FROM `codes_r` WHERE `id` = '.$id;
if($us == true) {
echo '<a href="/codes/new_code.php?id='.htmlspecialchars($_GET['id']).'" class="block"><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 `codes` 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 `codes` WHERE `ref` = '.$id.' ORDER BY `id` DESC LIMIT '.$pg->start.', '.$pg->num;
$query = $db->query($phq);
while ($row = $query -> fetch(PDO::FETCH_LAZY))
{
?><a href="/codes/show_code.php?id=<?=$row->id?>" class="block"><img src="/images/page_white_code.png" alt=""/> <?=$row->name?></a></div><?php
}
//echo $pg->display('?page=');
echo $pg->display('?id='.$id.'&page=');
}
}
require_once('../includes/Footers.php');
?>