Файл: world-faces.ru/world-faces.ru/tovar/dir.php
Строк: 21
<?
/* venix & bezh */
include_once '../i.php';
pdo();
$set['title']='Товары';
verh();
$category=intval($_GET['category']);
$pre = DB::$dbs->QueryFetch("SELECT * FROM `tovar_category` where `id` = ? limit 1",array($category));
$pre2 = DB::$dbs->QueryFetch("SELECT * FROM `tovar_category` where `id_cat` = ? limit 1",array($pre[id]));
if(empty($pre['name']) OR empty($category)){echo'<div class="prof">Неизвестная ошибка!</div>'; niz(); exit;}
$time = $_SERVER['REQUEST_TIME'];
$cats = DB::$dbs->querySingle("SELECT count(*) from `tovar_category` where `id_cat` = ?",array($category));
echo '<div class="prof"><a href="index.php">Товары</a>'.(($pre['id_cat']!==0)?'-><a href="dir.php?category='.$pre2['id'].'">'.$pre2['name'].'</a>->':'->').''.(($pre2['id_cat']!==0)?'<a href="dir.php?category='.$pre['id'].'">'.$pre['name'].'</a>':'<a href="dir.php?category='.$pre2['id'].'">'.$pre2['name'].'</a>').'</div>';
if($cats==0){echo'<div class="prof">Разделов нет!</div>';}else{
$c = DB::$dbs->query("SELECT * FROM `tovar_category` where `id_cat` = ? order by `pos` desc limit 10",array($category));
while ($cat = $c -> Fetch()){
if(!is_dir($cat['path'])){
DB::$dbs->query("DELETE FROM `tovar_category` where `id` = ? limit 1",array($cat[id]));
DB::$dbs->query("DELETE FROM `tovar` where `id_cat` = ?",array($cat[id]));
}
$tovars = DB::$dbs->querySingle("Select count(*) from `tovar` where `infolder` = ?",array($cat[infolder]));
echo '<div class="prof"><img src="img/folder.png" alt="*"/><a href="dir.php?category='.$cat['id'].'">'.$cat['name'].'</a> ('.$tovars.')</div>';
}
}
echo '<div class="prof"><a href="admin.php?mod=addc&category='.$category.'">Создать раздел</a></div>';
echo '<div class="prof"><a href="sell.php?category='.$category.'&mod=form">Загрузить товар</a></div>';
echo '<div class="prof"><a href="/">В магазин</a></div>';
niz();
?>