Файл: zc/kat.php
Строк: 22
<?
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_kat` WHERE (`id`=?)",array ((int) $_GET['id']));
if ($query -> rowCount () == 0) {
header ('location: /zc');
exit;
}
$kat = $query -> fetch ();
H ($kat['name'], '<a href="/zc" style="color:white;">ЗЦ</a> / ' . $kat['name'] . ' / Подкатегории');
echo '
<div class="ram">
';
if (DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_pk` WHERE (`id_kat`='" . $kat['id'] . "')") == 0) {
echo '
<div class="raz">
Подкатегорий нет!
</div>
';
}
else {
$query = DB :: $dbs -> query ("SELECT * FROM `zc_pk` WHERE (`id_kat`='" . $kat['id'] . "')");
while ($pk = $query -> fetch ()) {
$c_f = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_f` WHERE (`id_kat`='" . $kat['id'] . "') AND (`id_pk`='" . $pk['id'] . "') AND (`dop`='da')");
$n_f = DB :: $dbs -> querySingle ("SELECT COUNT(*) FROM `zc_f` WHERE (`id_kat`='" . $kat['id'] . "') AND (`id_pk`='" . $pk['id'] . "') AND (`dop`='da') AND (`time`>'" . (time () - 86400) . "')");
echo '
<div class="raz">
<img src="/images/unknown.png" alt=""/> <a href="/zc/pk' . $pk['id'] . '">' . $pk['name'] . '</a> (' . $c_f . ($n_f != 0 ? '/<b style="color:red;">+' . $n_f . '</b>' : '') . ')
</div>
';
}
}
echo '</div>';
F ();
?>