<?
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_lin = mysql_fetch_assoc(mysql_query("SELECT * FROM `tanks_sclad` WHERE `id`='".intval($_GET['id'])."'"));
$delete_sclad = mysql_query("DELETE FROM `tanks_sclad` WHERE `id` = '$_GET[id]'");
if($delete_sclad == true) {

mysql_query("UPDATE `tanks` SET `serebro`=`serebro`-'$sclad_lin[price]' WHERE `id_u`='".$user['id']."'");
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">Из склада была продана'.$sclad_lin['name'].'</div>
                    </div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>';
}
}


$sclads = mysql_query("SELECT * FROM `tanks_sclad` WHERE `user` = '$user[id]'");
if(mysql_num_rows($sclads) > 0) {
while($sclad = mysql_fetch_array($sclads)) {

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/'.$sclad['screen'].'" alt="'.$sclad['name'].'" title="'.$sclad['name'].'">
                        <span class="mask2"> </span>
                      </div>
                      <div class="ml58 small white sh_b bold">
                        <span class="green2">'.$sclad['name'].'</span>
                        <br>Для:  <span class="gray1">'.$sclad['name_tanks'].'</span><br>
						<img src="images/icons/silver.png"> Кредитов: '.$sclad['price'].'
                      </div>
                      <div class="clrb"></div>
                    </div>
                    <div class="bot">
                      <a class="simple-but border" href="?tanks&id='.$sclad['id'].'">
                        <span>
                          <span>          
Продать
                          </span>
                        </span>
                      </a>
                    </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">
                    <div class="green2 cntr bold sh_b small pb10">
На вашем складе ничего не найдено.
</div>
                  </div>
                </div>
              </div>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
</div>';
}


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