<?
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'] = 'Танки - Иccледовать';
include_once '../sys/inc/thead.php';
title();
err();
aut();

echo '<link rel="stylesheet" type="text/css" href="style.css"/>';
include_once 'function.php';
	if(isset($_GET['world'])){
if(isset($_GET['id'])){

$coding_tanks = mysql_fetch_array(mysql_query("SELECT * FROM `tanks_magazin` WHERE `id`='".intval($_GET['id'])."'"));

if($tanks_code['serebro'] >= $coding_tanks['price'] or $tanks_code['experience'] >= $coding_tanks['experience']) {
    mysql_query("UPDATE `tanks` SET `tank`='".$coding_tanks['id']."',`serebro`=`serebro`-$coding_tanks[price],`experience`=`experience`-$coding_tanks[experience] WHERE `id_u`='".$user['id']."'");
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="white medium cntr bold mb5">Покупка танка</div>
                    <div class="mb5 inbl">
                      <div class="thumb fl">
                        <img src="images/batt5.jpg">
                        <span class="mask"> </span>
                      </div>
                      <div class="ml58 small white sh_b bold">
                        <span class="green2">Вы успешно приобрели танк '.$coding_tanks['name'].'</span>
                        <br>
                      </div>
                      <div class="clrb"></div>
                    </div>
					                    <div class="bot">
                      <a class="simple-but border" href="index.php">
                        <span>
                          <span>Вернуться в ангар
                          </span>
                        </span>
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>';

include_once '../sys/inc/tfoot.php';
exit;
}
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">У вас недостаточно средств на покупку танка '.$coding_tanks['name'].'</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>';

}}
}



$tank = mysql_query("SELECT * FROM `tanks_magazin`");
while($tanks = mysql_fetch_array($tank)) {
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="small bold cD2 cntr sh_b pb5 pt5">'.$tanks['name'].'</div>
                    <table>
                      <tbody>
                        <tr>
                          <td>
                            <img class="tank-img" alt="tank" src="images/tanks/'.$tanks['screen'].'">
                          </td>
                        </tr>
                      </tbody>
                    </table>
                    <div class="bot">
                      <a class="simple-but border" href="?world&id='.$tanks['id'].'">
                        <span>
                          <span>Купить за 
                            <img class="ico vm" src="images/icons/silver.png" alt="Серебро" title="Серебро">
                             '.$tanks['price'].' | 
							   <img class="ico vm" src="images/icons/exp.png" alt="Опыта" title="Опыта">
							 '.$tanks['experience'].'
                          </span>
                        </span>
                      </a>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>';
}
include_once '../sys/inc/tfoot.php';
?>