<?php
include 'system/bd.php';
include 'system/cook.php';
include ("system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1 && isset($_GET['id'])){
include 'system/head.php';


if (mysql_result(mysql_query("SELECT COUNT(*) FROM `shop` WHERE `set`='".intval($_GET['id'])."'"),0)){
	$us=mysql_fetch_assoc(mysql_query("SELECT * FROM `shop` WHERE `set`='".intval($_GET['id'])."'"));
}else{
echo 'не такого юзера';

echo '<a href="setting.php"> <img src="/img/foot/index.png" alt="*"/> Вернуться</a></div><hr>';
include 'system/foot.php';
	exit;
}
// 
   
if($user[lvl] < 10){
echo ' <div class="title"> Магазин </div>
<div class="empty_block item_center">
Вещи доступны с 10-го уровня </center> </div>';
include './system/foot.php';
exit;
}
$r= mysql_query("SELECT * FROM `shop` WHERE `set`= '".intval($_GET['id'])."' ");
   $m = mysql_fetch_array($r);
echo"<div class='title'> $m[set_name] </div>
<div class='empty_block'> ";
$cop=10;
$ca=mysql_result(mysql_query("SELECT COUNT(*) FROM `shop` WHERE `set`= '".intval($_GET['id'])."' "),0);
$cp=ceil($ca/$cop);
if(isset($_GET['page']) && is_numeric($_GET['page'])){
$page = $_GET['page'];
if($_GET['page']>$cp) $page=$cp;
if($_GET['page']<1)$page=1;
}else{
$page=1;
}
$start=$page*$cop-$cop;
$dlist = 'list1';
$req = mysql_query("SELECT * FROM `shop` WHERE `images`= '".intval($_GET['id'])."' ORDER BY gold DESC LIMIT $start,$cop");
////////////////////////////

if($user){
     switch($mag[quality]) {    
  case 0:
        $quality= Хлам;
        $hone = 5;
        $q = 0;
  break;   
  case 1:
        $quality= Обычный;
        $hone = 10;
        $q = 1;
  break;
  case 2:
       $quality= Необычный;
       $hone = 15;
       $q = 2;
 break;
 case 3:
      $quality= Редкий;
      $hone = 25;
      $q = 3;
 break;
 case 4:
      $quality= Эпический;
      $hone = 30;
      $q = 4;
  break;
 case 5:
     $quality= Легендарный;
     $hone = 40;
     $q = 5;
 break;
 case 6:
    $quality= Мифический;
    $hone = 50;
    $q = 6;
 break;
}}

$avto=mysql_num_rows($req);
if($avto>=1){
While($mag = mysql_fetch_array($req))
{

echo"
 <table>
                            <tbody><tr>
                    <td class='b40px'>
<img src='/img/items/$mag[tip]/$mag[images].png'>
</td><td>";                                                               

echo"<img src='../img/star/".$q.".png'>
<a href='magazin.php?mod=infa&id=$mag[id]'> $mag[name]</a>[0/$hone]";
echo"<br> $quality, $mag[lvl] уровень


</td> </tr>";
}
echo ' </tbody> </table> </div>
</div>';
}

echo"<div class='block_link'>
<a href='magazin.php?'> <img src='img/images/arrow.png'> Вернуться</a></div>";



}else{
header ("Location: index.php"); exit;
}
include 'system/foot.php';
?>
