if ($id) |
{ |
$tip = mysql_query("SELECT * FROM `chop` WHERE `id`= '" . $id . |
"' LIMIT 1"); |
$type = mysql_fetch_assoc($tip); |
$tips = $type['type']; |
switch ($tips) |
{ |
|
case 'r': |
echo '<div class="phdr">'; |
echo '<b>Магазин | ' . $type['name'] . '</b></div>'; |
|
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `chop` WHERE `refid`='" . |
$id . "'"), 0); |
if ($count) |
{ |
$req = mysql_query("SELECT * FROM `chop` WHERE `refid`='$id'"); |
|
while ($res = mysql_fetch_array($req)) |
{ |
|
//подкаталоги |
$t = mysql_fetch_assoc(mysql_query("SELECT * FROM `chop` WHERE `id`= '" . |
$res['id'] . "' LIMIT 1")); |
$ts = $t['type']; |
if ($ts == 'k') |
{ |
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `tovar` WHERE `refid`='" . |
$t['id'] . "'"), 0); |
} |
else |
{ |
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `chop` WHERE `refid`='" . |
$res['id'] . "'"), 0); |
} |
|
echo '<a class="menu" href="index.php?id=' . $res['id'] . |
'"><img src="/images/dir.png" alt="*"/> ' . checkout($res['name'], |
1, 1) . ' [' . $count . '/' . $cuntsss . ']</a>'; |
|
if ($rights >= 7) |
echo '<a class="delete" href="submit.php?id=' . $res['id'] . |
'">X</a>'; |
if (!empty($res['opis'])) |
{ |
$text = $res['opis']; |
$text = mb_substr($text, 0, 100); |
$text = checkout($text, 1, 1); |
} |
|
++$i; |
} |
} |
else |
{ |
echo '<div class="list">Каталог пуст</div>'; |
} |
|
if ($rights >= 7) |
{ |
echo '<div class="gr">Создаем каталог</div>'; |
echo '<form action="submit.php?id=' . $id . |
'" method="post"><div class="list">'; |
echo '<b>Название:</b><br/><input type="text" name="name" maxlength="40" value="" /><br />'; |
echo '<b>Описание:<small>max 150</small></b><br/><input type="text" name="opis" /><br/>'; |
echo '<input type="checkbox" name="type" value="k" /> Для файлов<br/>'; |
echo '<input type="submit" name="chop_kat" value="Создать"/></div></form>'; |
} |
echo '<a class="menu" href="?id=' . $type['refid'] . '">Назад</a>'; |
break; |
|
case 'k': |
echo '<div class="phdr">'; |
echo '<b>Магазин | ' . $type['name'] . '</b></div>'; |
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `tovar` WHERE `refid`='" . |
$id . "'"), 0); |
if ($count) |
{ |
$req = mysql_query("SELECT * FROM `tovar` WHERE `refid`='$id'"); |
|
while ($res = mysql_fetch_array($req)) |
{ |
|
//тут выводы товаров |
|
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `tovar` WHERE `refid`='" . |
$id . "'"), 0); |
echo '<a class="menu" href="tovar.php?id=' . $res['id'] . '">' . |
checkout($res['name'], 1, 1) . '</a> '; |
if ($rights >= 7) |
echo '<a class="delete" href="submit.php?id=' . $res['id'] . |
'">X</a>'; |
if (!empty($res['opis'])) |
{ |
$text = $res['opis']; |
$text = mb_substr($text, 0, 100); |
$text = checkout($text, 1, 1); |
} |
|
++$i; |
} |
|
} |
else |
{ |
echo '<div class="gr">Товар еще не добавлен</div>'; |
} |
if ($user_id && !$ban['1'] && !$ban['11']) |
{ |
echo '<div class="list"><form action="add.php?&id=' . $id . |
'" method="post"><input type="submit" value="Добавить товар" /></form></div>'; |
} |
echo '<div class="list"><a href="?id=' . $type['refid'] . |
'"><font color="red">Назад</font></a></div>'; |
break; |
|
default: |
|
echo '<div class="list"><b>Ошибка!</b><br />Товар удален или же не существует!</p></div>'; |
break; |
} |
|
} |
else |
{ |
// Список разделов магазина |
|
echo '<div class="gr">'; |
echo '<b>Магазин</b></div>'; |
|
$req = mysql_query("SELECT * FROM `chop` WHERE `type`='r' and `refid`='0' ORDER BY `real`"); |
|
while ($res = mysql_fetch_array($req)) |
{ |
|
$count = mysql_result(mysql_query("SELECT COUNT(*) FROM `chop` WHERE `refid`='" . |
$res['id'] . "'"), 0); |
echo '<a class="menu" href="index.php?id=' . $res['id'] . |
'"><img src="/images/dir.png" alt="*"/> ' . $res['name'] . ' [' . |
$count . '/' . $c . ']</a>'; |
if ($rights >= 7) |
echo '<a class="delete" href="submit.php?id=' . $res['id'] . |
'">X</a>'; |
if (!empty($res['opis'])) |
{ |
$text = $res['opis']; |
$text = mb_substr($text, 0, 100); |
$text = checkout($text, 1, 1); |
|
} |
|
++$i; |
} |
|
if ($rights >= 7) |
{ |
echo '<div class="gr">Создание раздела магазина</div>'; |
echo '<form action="submit.php" method="post"><div class="list">'; |
echo '<b>Имя раздела:</b><br/><input type="text" name="name" maxlength="40" value="" /><br />'; |
echo '<b>Описание:<small>max 150</small></b><br/><input type="text" name="opis" /><br/>'; |
echo '<input type="submit" name="chop_raz" value="Создать"/></div></form>'; |
} |
} |