File size: 1.48Kb
<?php
require_once(HOME .'/incfiles/header.php');
echo '<div class="title">Загрузки</div>';
$catcount = mysql_result(mysql_query("SELECT COUNT(*) FROM `loads_cat` WHERE `type` = 'main'"), 0);
if ($catcount==0){echo '<div class="menu">Категорий ещё нет!</div>';
}
if ($user['id']>=1){
$user_obj=$user['object'];
}
else {
$user_obj="6";
}
nav_start($catcount, $user_obj);
$catcount_result = mysql_query(" SELECT * FROM `loads_cat` WHERE `type` = 'main' ORDER BY `id` ASC LIMIT $start, $user_obj");
while($cat = mysql_fetch_assoc($catcount_result)){
$cat_name= $cat['name'];
$cat_id = $cat['id'];
$cat_opis = $cat['opis'];
$directory = mysql_result(mysql_query("SELECT COUNT(*) FROM `loads` WHERE `cat_id` = '".$cat_id."' "), 0);
if ($user['level']==2){
echo '<div class="menu">
<a href="/loads/cat.php?id='.$cat_id.'"><b>'.output($cat_name).'</b></a> ('.$directory.')<br />
'.output($cat_opis).'<br />
<a href="/loads/admin.php?act=delete_cat&id='.$cat_id.'">Удалить</a>
</div>';
}
else {
echo '<div class="menu">
<a href="/loads/cat.php?id='.$cat_id.'"><b>'.output($cat_name).'</b></a> ('.$directory.')<br />
'.output($cat_opis).'
</div>';
}
}
view_nav();
if ($user['level']==2){
echo '<div class="block">
<a href="/loads/admin.php?act=create_cat">Создать категорию</a>
</div>';
}
echo '<div class="block">
<a href="/">На главную</a>
</div>';
require_once(HOME .'/incfiles/footer.php');
?>