<?php

require_once('conf/dbc.php');
require_once('conf/session_start.php');
require_once('conf/ban.php');
if ((!isset($_SESSION['id'])) or (!isset($_SESSION['nick'])))  {
?>
<script type="text/javascript">
  document.location.href = "login.php";
</script>
<?php
}
$page_title = 'Суслов';
require_once('conf/head.php');
require_once('conf/top.php');
$user_id = abs(intval($_SESSION['id']));
  $query = "Select * from users where id = '$user_id'";
  $result = mysqli_query($dbc, $query) or die ('Ошибка передачи запроса к БД');
  $row = mysqli_fetch_array($result);
  $money = $row['money'];
  $vip = $row['vip'];
  $habar = $row['habar'];
  $lvl = $row['lvl'];
$type = abs(intval($_GET['type']));

  if ($type <> 1 and $type <> 2 and $type <> 3 and $type <> 4 and $type <> 5 and $type <> 6) {
    if ($lvl >=21) {$type = 4;}
    if ($lvl >12 and $lvl <21) {$type = 3;}
    if ($lvl >=3 and $lvl <12 ) {$type = 2;}
    if ($lvl <3) {$type = 1;}
  }
?>
<div id="main">

    <center><p class="name">Торговец Суслов</p></center>
  </div>
  <div class="stats">
    <p><img src="img/ico/syslov.png"  width="110" height="170"/></p>
<div class="zx">
    <p class="net"> - Дарова STALKER. Как жизнь? Снаряга на витрине.. Смотри - выбирай..</p>
  </div>
<div class="stats"><p>[<a <?php if ($type == 1) {?>class="white"<?php }?> href="salesman.php?type=1">Нов</a>] [<a <?php if ($type == 2) {?>class="white"<?php }?> href="salesman.php?type=2">Быв</a>] [<a <?php if ($type == 3) {?>class="white"<?php }?> href="salesman.php?type=3">Вет</a>] [<a <?php if ($type == 4) {?>class="white"<?php }?> href="salesman.php?type=4">Лег</a>]</p>
  </div>
  <?php 
  ?>
  <div class="stats">
    <p>[<img src="img/ico/money.png" width="12" height="12"/> <span class="white"><?php echo "$money"; ?></span>] [<img src="img/ico/materials.png" width="12" height="12"/> <span class="white"><?php echo "$habar"; ?></span>]</p>
	<div class="zx">
	<p class="bonus">Советы:</p>
<p class="clothes"><span class="bonus"><img src="img/ico/money.png" width="12" height="12"/> Нет у тебя RUB ? [<a href="paymoney.php">пополни счет</a>]</span></p>
	</div>
  </div>
  <div class="stats">
  <p class="podmenu"><?php 
  if ($type == 1) {?><img src="img/ico/class1.png" width="12" height="12"/> Новичок<?php }
  if ($type == 2) {?><img src="img/ico/class2.png" width="12" height="12"/> Бывалый<?php }
  if ($type == 3) {?><img src="img/ico/class3.png" width="12" height="12"/> Ветеран<?php }
  if ($type == 5) {?><img src="img/ico/class3.png" width="12" height="12"/> VIP<?php }
  if ($type == 6) {?><img src="img/ico/class3.png" width="12" height="12"/>Артефакты</br><?php }
  if ($type == 4) {?><img src="img/ico/class4.png" width="12" height="12"/> Легенда<?php }?>
  </p>
  </div>
  </div>
  <div class="stats">
  <?
  if ($type == 6){
  
  echo'<p class="white" style="background-color:#1e2833;"><b>[Золотая рыбка]</b></p>';
  ?>
  
	    <p>
		<img src="img/artf/1.jpg" width="50" height="50"/></br> Снижает перезарядку оружия до 1 сек.</p>
		<p class="white" style="background-color:#1e2833;"><b>[Ночная звезда]</b></p>
        <img src="img/artf/2.jpg" width="50" height="50"/></br>Приумножает шансы получения ежедневного бонуса.</p>
		<p class="white" style="background-color:#1e2833;"><b>[Огненый шар]</b></p>
        <img src="img/artf/3.jpg" width="50" height="50"/></br>+30000 к урону</p>
		<p class="white" style="background-color:#1e2833;"><b>[Ломоть мяса]</b></p>
        <img src="img/artf/4.jpg" width="50" height="50"/></br>+ 30000 к здоровью.</p>
		<p class="white" style="background-color:#1e2833;"><b>[Кристал]</b></p>
        <img src="img/artf/5.jpg" width="50" height="50"/></br>+30000 к броне.</p>
		<p class="white" style="background-color:#1e2833;"><b>[Слизь]</b></p>
        <img src="img/artf/6.jpg" width="50" height="50"/></br>Артефакт, который можно подкинуть врагу. Снижает все характеристики на 20000</p>
		<p class="white" style="background-color:#1e2833;"><b>[Пустышка]</b></p>
        <img src="img/artf/7.jpg" width="50" height="50"/></br>+20000 к выбраной Вами характеристике.</p>		
		<?
		}else{
  ?>
    <p class="white"><p class="link"><b>[Шлемы]</b></p>
	
	<?php

	$query_c = "Select name,shlem_id,price, price_hab,lvl_need,screen,klass from shlem where klass = '$type'";
    $result_c = mysqli_query($dbc, $query_c) or die ('Ошибка передачи запроса к БД');
    while ($row_cl = mysqli_fetch_array($result_c)) {?>
	<div class="zx">
	<table width="190" border="0" cellpadding="0" cellspacing="0">
      <tbody>
      <tr>

      <td width="54" valign="top"><img src="img/shlem/<?php echo $row_cl['screen'];?>" alt="Слот №5" width="55" height="55"/></td>
      <td width="136" valign="top">
	  <div class="clothes">
	    <p>
		<?php

		if ($row_cl['klass'] == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 5) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 6) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		?><a class="white" href="sale_thing.php?thing=<?php echo $row_cl['shlem_id'];?>&type=4"><?php echo $row_cl['name'];?></a></p>
		<p><span class="white"><?php echo $row_cl['lvl_need'];?></span> ур, новый</p>
		<p>Цена:
		<?php $pr=0; if ($row_cl['price_hab'] >=0) { $pr=1;?>[<img src="img/ico/materials.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price_hab'];?></span>]<br /><?php }?>
		<?php if ($row_cl['price'] >=0) {$pr=1;?>[<img src="img/ico/money.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price'];?></span>]<?php }?>
		<?php 
		if ($pr==0) {?>[не продаётся, но можно купить у админа]<?php }?></p>
      </div>
	  </td>
      </tr>
      </tbody>
      </table>
	</div>
	<?php
	}
	
	////////////////////шлемам
  ?>
    <p class="white"><p class="link"><b>[Одежда]</b></p>
	
	<?php

	$query_c = "Select name,clothes_id,price, price_hab,lvl_need,screen,klass from clothes where klass = '$type'";
    $result_c = mysqli_query($dbc, $query_c) or die ('Ошибка передачи запроса к БД');
    while ($row_cl = mysqli_fetch_array($result_c)) {?>
	<div class="zx">
	<table width="190" border="0" cellpadding="0" cellspacing="0">
      <tbody>
      <tr>

      <td width="54" valign="top"><img src="img/clothes/<?php echo $row_cl['screen'];?>" alt="Слот №1" width="60" height="80"/></td>
      <td width="136" valign="top">
	  <div class="clothes">
	    <p>
		<?php

		if ($row_cl['klass'] == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 5) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 6) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		?><a class="white" href="sale_thing.php?thing=<?php echo $row_cl['clothes_id'];?>&type=1"><?php echo $row_cl['name'];?></a></p>
		<p><span class="white"><?php echo $row_cl['lvl_need'];?></span> ур, новый</p>
		<p>Цена:
		<?php $pr=0; if ($row_cl['price_hab'] >=0) { $pr=1;?>[<img src="img/ico/materials.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price_hab'];?></span>]<br /><?php }?>
		<?php if ($row_cl['price'] >=0) {$pr=1;?>[<img src="img/ico/money.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price'];?></span>]<?php }?>
		<?php 
		if ($pr==0) {?>[не продаётся, но можно купить у админа]<?php }?></p>
      </div>
	  </td>
      </tr>
      </tbody>
      </table>
	</div>
	<?php
	}
	
	////////////////////Конец одежде.
	////////////////////Пистолет
    ?>
	</div>
	<div class="stats">
	<p class="white"><p class="link"><b>[Пистолеты]</b></p>
	<?php
	$query_c = "Select name,pistols_id,price, price_hab,lvl_need,screen,klass from pistols where klass = '$type'";
    $result_c = mysqli_query($dbc, $query_c) or die ('Ошибка передачи запроса к БД');
    while ($row_cl = mysqli_fetch_array($result_c)) {?>
	<div class="zx">
	<table width="190" border="0" cellpadding="0" cellspacing="0">
      <tbody>
      <tr>
      <td width="54" valign="top"><img src="img/weapons/<?php echo $row_cl['screen'];?>" alt="Слот №1" width="60" height="40"/></td>
      <td width="136" valign="top">
	  <div class="clothes">
	    <p>
		<?php
		if ($row_cl['klass'] == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 5) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		?><a class="white" href="sale_thing.php?thing=<?php echo $row_cl['pistols_id'];?>&type=2"><?php echo $row_cl['name'];?></a></p>
		<p><span class="white"><?php echo $row_cl['lvl_need'];?></span> ур, новый</p>
		<p>Цена:
		<?php $pr=0; if ($row_cl['price_hab'] >=0) { $pr=1;?>[<img src="img/ico/materials.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price_hab'];?></span>]<br /><?php }?>
		<?php if ($row_cl['price'] >=0) {$pr=1;?>[<img src="img/ico/money.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price'];?></span>]<?php }?>
		<?php 
		if ($pr==0) {?>[не продаётся, но можно купить у админа]<?php }?></p>
      </div>
	  </td>
      </tr>
      </tbody>
      </table>
	</div>
	<?php
	}
    ?>
	</div>
	<div class="stats">
    <p class="white"><p class="link"><b>[Автоматы]</b></p>
	<?php
	$query_c = "Select name,weapons_id,price, price_hab,lvl_need,screen,klass from weapons where klass = '$type'  order by max_stats_yron ASC";
    $result_c = mysqli_query($dbc, $query_c) or die ('Ошибка передачи запроса к БД');
    while ($row_cl = mysqli_fetch_array($result_c)) {?>
	<div class="zx">
	<p class="clothes">
		<?php
		if ($row_cl['klass'] == 1) {?><img src="img/ico/class1.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 2) {?><img src="img/ico/class2.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 3) {?><img src="img/ico/class3.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 4) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		if ($row_cl['klass'] == 5) {?><img src="img/ico/class4.png" width="12" height="12"/><?php }
		?><a class="white" href="sale_thing.php?thing=<?php echo $row_cl['weapons_id'];?>&type=3"><?php echo $row_cl['name'];?></a></p>
	<td width="54" valign="top"><img src="img/weapons/<?php echo $row_cl['screen'];?>" alt="Слот №1" width="150"/></td>
	<div class="clothes">
		<p><span class="white"><?php echo $row_cl['lvl_need'];?></span> ур, новый</p>
		<p>Цена:
		<?php $pr=0; if ($row_cl['price_hab'] >=0) { $pr=1;?>[<img src="img/ico/materials.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price_hab'];?></span>]<br /><?php }?>
		<?php if ($row_cl['price'] >=0) {$pr=1;?>[<img src="img/ico/money.png" width="12" height="12"/> <span class="white"><?php echo $row_cl['price'];?></span>]<?php }?>
		<?php 
		if ($pr==0) {?>[не продаётся, но можно купить у админа]<?php }?></p>
      </div>
	</div>
	<?php
	}

	}
    ?>
<p class="zx"></p>
  <div class="r2"><a style="text-decoration:none;" href="baza_chn.php" ><img src="img/ico/left.png" alt="."/>Выйти</a></div>

<?php
require_once('conf/navig.php');
require_once('conf/foot.php');
mysqli_close($dbc);
?>

</body>
</html>