Файл: zc/pk.php
Строк: 16
<?
include '../system/sys.php';
include '../system/funcs.php';
if (!isset ($us)) {
header ('location: /');
exit;
}
if (!isset ($_GET['id'])) {
header ('location: /zc');
exit;
}
$query = DB :: $dbs -> query ("SELECT * FROM `zc_pk` WHERE (`id`=?)", array ((int) $_GET['id']));
if ($query -> rowCount () == 0) {
header ('location: /zc');
exit;
}
$pk = $query -> fetch ();
$kat = DB :: $dbs -> queryFetch ("SELECT * FROM `zc_kat` WHERE (`id`='" . $pk['id_kat'] . "')");
H ($pk['name'], '<a href="/zc" style="color:white;">ЗЦ</a> / <a href="/zc/kat' . $kat['id'] . '" style="color:white;">' . $kat['name'] . '</a> / ' . $pk['name']);
echo '<div class="ram">';
$items = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_f` WHERE (`id_kat`='" . $kat['id'] . "') AND (`id_pk`='" . $pk['id'] . "') AND (`dop`='da')");
$items_per_page = 10;
$pages = ceil ( $items / $items_per_page );
$page = (int) $_GET['page'];
if ($page < 1) {
$page = 1;
}
if ($page > $pages) {
$page = $pages;
}
$start = $page * $items_per_page - $items_per_page;
if ($items != 0) {
$query = DB :: $dbs -> query ("SELECT * FROM `zc_f` WHERE (`id_kat`='" . $kat['id'] . "') AND (`id_pk`='" . $pk['id'] . "') AND (`dop`='da') ORDER BY `id` DESC LIMIT $start, $items_per_page");
while ($f = $query -> fetch ()) {
echo '<div class="raz">' . fname ($f['id']) . ' (' . sizef ($f['size']) . ') ' . ($f['time'] > (time () - 86400) ? ' <b style="color:red;">new</b>' : '') . '</div>';
}
if ($pages > 1) {
echo '<div class="lst">' . pages ('/zc/pk' . $pk['id']) . '</div>';
}
}
else {
echo '<div class="raz">Здесь файлов нет!</div>';
}
echo '</div>';
echo '<div class="list1"><a href="/zc/up.php?pr=' . $pk['id'] . '">Выгрузить файл</a></div>';
F ();
?>