View file sdark.mobi/clan/up_storage.php

File size: 1.81Kb
<?php
require_once '../core/system.php';
echo only_reg();
echo ban();
$header = "Постройки клана / Хранилище";
require_once H.'core/head.php';
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`  = '$user[clan]'"));
$d=$clan['storage']+1;
if($clan['storage']==1){$st=200; $mest=3;}
if($clan['storage']==2){$st=400; $mest=6;}
if($clan['storage']==3){$st=700; $mest=9;}
if($clan['storage']==4){$st=1300; $mest=12;}
if($clan['storage']==5){$st=2000; $mest=15;}
if($clan['storage']==6){$st=3300; $mest=18;}
if($clan['storage']==7){$st=5000; $mest=21;}
if($clan['storage']==8){$st=7000; $mest=24;}
if($clan['storage']==9){$st=9800; $mest=27;}
if($clan['storage']==10){$st=14000; $mest=30;}
if($clan['storage']==11){$st=20000; $mest=33;}
if($clan['storage']==12){$mest=36;}
$st=floor($st*0.80);
$goldd=$st*100;
if($clan['gold']<$goldd){
header("Location: /clan/storage?id=$clan[id]");
$_SESSION['err'] = 'Недостаточно золота';exit;}
if($user['dolz']!='основатель'){$_SESSION['err'] = "Ошибка";
header('Location: /clan/storage?id='.$clan['id'].'');
exit();}
if($clan['storage']>=12){$_SESSION['err'] = "Ошибка";
header('Location: /clan/storage?id='.$clan['id'].'');
exit();}
$gold=$clan['gold']-$goldd;
$rukzak=$user['rukzak']+3;
$t=time();
mysql_query("INSERT INTO `zur` set `kto` = ".$user['id'].", `name` = 'улучшил хранилище', `time` = '".$t."', `clan`='$user[clan]'");
mysql_query("UPDATE `clan` SET `gold`='$gold', `storage`='$d',`storage_bon`='$mest'  WHERE `id`='$user[clan]'");
mysql_query("UPDATE `user` SET `rukzak`='$rukzak'  WHERE `clan`='$user[clan]'");
header("Location: /clan/storage?id=$clan[id]"); 
$_SESSION['message'] = "<font color='94ED18'> Хранилище повышено до $d уровня </font>";

require_once H.'core/foot.php';
?>