<?
include_once '../sys/inc/start.php';
include_once '../sys/inc/compress.php';
include_once '../sys/inc/sess.php';
include_once '../sys/inc/home.php';
include_once '../sys/inc/settings.php';
include_once '../sys/inc/db_connect.php';
include_once '../sys/inc/ipua.php';
include_once '../sys/inc/fnc.php';
include_once '../sys/inc/user.php';


$set['title']='Магазин'; // заголовок страницы

include_once '../sys/inc/thead.php';
title();
echo '<link rel="stylesheet" href="style.css" type="text/css" />';
include_once 'function.php';

if(isset($_GET['tanks'])){
$sclad = mysql_fetch_assoc(mysql_query("SELECT * FROM `tanks_shop` WHERE `id`='".intval($_GET['id'])."'"));
if($tanks_code['serebro'] >= $sclad['price'] or $tanks_code['experience'] >= $sclad['opt']) {

mysql_query("INSERT INTO `tanks_sclad` (`screen`,`user`,`name`,`price`,`name_tanks`) VALUES ('$sclad[screen]','$user[id]','$sclad[name]','$sclad[sell_price]','$tank_lin[name]')");

echo '<div class="trnt-block mb6">
    <div class="wrap1">
      <div class="wrap2">
        <div class="wrap3">
          <div class="wrap4">
            <div class="wrap5">
              <div class="wrap6">
                <div class="wrap7">
                  <div class="wrap8">
                    <div class="wrap-content-mini">
                      <div class="mt5 mb5 small green1 cntr">Вы успешно купили:  <b>'.$sclad['name'].'</b><br/> 
					  Потрачено опыта: <b>'.$sclad['price'].'</b><br/>
					  Потрачено кредитов: <b>'.$sclad['opt'].'</b> </div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>';
}else {

echo '<div class="trnt-block mb6">
    <div class="wrap1">
      <div class="wrap2">
        <div class="wrap3">
          <div class="wrap4">
            <div class="wrap5">
              <div class="wrap6">
                <div class="wrap7">
                  <div class="wrap8">
                    <div class="wrap-content-mini">
                      <div class="small bold cD2 cntr sh_b pb5 pt5">У вас недостаточно средств на покупку <br/>'.$sclad['name'].'</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>';

}
}


$shop = mysql_query("SELECT * FROM `tanks_shop`");
while($shops = mysql_fetch_array($shop)) {

echo '<div class="trnt-block">
  <div class="wrap1">
    <div class="wrap2">
      <div class="wrap3">
        <div class="wrap4">
          <div class="wrap5">
            <div class="wrap6">
              <div class="wrap7">
                <div class="wrap8">
                  <div class="wrap-content">
                    <div class="mb5 inbl">
                      <div class="thumb fl">
                        <img src="images/magazin/'.$shops['screen'].'" alt="'.$shops['name'].'" title="'.$shops['name'].'">
                        <span class="mask2"> </span>
                      </div>
                      <div class="ml58 small white sh_b bold">
                        <span class="green2">'.$shops['name'].'</span>
                        <br>Для:  <span class="gray1">'.$tank_lin['name'].'</span><br>
						<img src="images/icons/exp.png"> Опыта: '.$shops['price'].'<br/>
						<img src="images/icons/silver.png"> Кредитов: '.$shops['opt'].'
                      </div>
                      <div class="clrb"></div>
                    </div>
                    <div class="bot">
                      <a class="simple-but border" href="?tanks&id='.$shops['id'].'">
                        <span>
                          <span>          
Купить и установить
                          </span>
                        </span>
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>';

}
include_once '../sys/inc/tfoot.php';
?>
