File size: 2.28Kb
<?php
@session_start();
require_once $_SERVER['DOCUMENT_ROOT']."/includes/start.php";
if(isset($_SESSION['auth']) and $_SESSION['auth']==1){
echo $_up;
$id = $_GET['id'];
if(eregi("[^0-9]" , $_GET['id'])){
header ("Location: /shop/?"); exit;
}
$query = mysql_fetch_assoc(mysql_query("SELECT * FROM `shop_cat` WHERE `id_cat`='$id' LIMIT 1"));
if(!$query){
header ("Location: /shop/?"); exit;
}
$cat = mysql_fetch_assoc(mysql_query("SELECT `name` FROM `shop_cat` WHERE `id_cat`='$id'"));
echo '<b><a href="./">Магазин</a>/ '.$cat['name'].'</b><br><br>';
$count_pres=mysql_result(mysql_query("SELECT COUNT(*) FROM `shop` WHERE `cat`=$id"), 0);
$page=isset($_GET['p'])?$_GET['p']:1;
$pres_q=mysql_query("SELECT * FROM `shop` WHERE `cat`=$id ORDER BY `id_present` LIMIT ".(($page-1)*10).", 10");
$total = mysql_result(mysql_query("SELECT COUNT(*) FROM `shop` WHERE cat=$id"), 0);
if($total==0){
echo 'В разделе нет вещей :('; exit;
}
while($post=mysql_fetch_array($pres_q)){
$present = mysql_fetch_assoc(mysql_query("SELECT `id_present`,`name`,`img`,`price`,`status` FROM `shop` WHERE `id_present`='$post[id_present]'")); //запрос на логин юзера
echo '<table width="70%"><tr><td valign="top" width="20%" style="font-size: 12px;font-family: Verdana, Arial;">';
echo '<img src="'.$present['img'].'" align="left" style="margin:1px 5px 1px 0px;" width="50" height="50"/>';
echo '</td><td valign="top" style="font-size: 11px;font-family: Verdana, Arial;">
<b><u>'.$present['name'].'</u></b><br><b style="color:#ff0000">Цена:</b> '.$present['price'].' Кр.<br>';
if($present['status']>=3){
if($usr['status']>=3){
echo '<a href="buy.php?id='.$present['id_present'].'"><b>Купить</b></a> | <a href="to.php?id='.$present['id_present'].'"><b>Подарить</b></u></a>';
}else{
echo '<font color="#FF0000"><b>Только для VIP</b></font>';
}
}else{
echo '<a href="buy.php?id='.$present['id_present'].'"><b>Купить</b></u></a> | <a href="to.php?id='.$present['id_present'].'"><b>Подарить</b></u></a>';
}
echo '</td></tr></table>';
}
nav($count_pres, $page, '?id='.$id.'&', 10); //навигация
echo '<br><br>';
echo $_down;
}else{
header ("Location: /?"); exit;
}
?>