View file sdark.mobi/clan/up_castle.php

File size: 1.62Kb
<?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['castle']+1;
if($clan['castle']==1){$st=300;}
if($clan['castle']==2){$st=600;}
if($clan['castle']==3){$st=1450;}
if($clan['castle']==4){$st=3550;}
if($clan['castle']==5){$st=7000;}
if($clan['castle']==6){$st=11950;}
if($clan['castle']==7){$st=16500;}
if($clan['castle']==8){$st=20500;}
if($clan['castle']==9){$st=34700;}
if($clan['castle']==10){$st=41000;}
if($clan['castle']==11){$st=50000;}
if($clan['castle']==12){}
$st=floor($st*0.80);
$goldd = $st*100;
if($clan['gold'] < $goldd){
header("Location: /clan/castle?id=".$clan['id']."");
$_SESSION['err'] = 'Недостаточно золота';
exit;
}
if($user['dolz']!='основатель'){
$_SESSION['err'] = 'Ошибка';
header('Location: /clan/castle?id='.$clan['id'].'');
exit();
}
if($clan['castle'] > 11){
$_SESSION['err'] = 'Ошибка';
header('Location: /clan/castle?id='.$clan['id'].'');
exit();
}
$gold = $clan['gold'] - $goldd;
$t = time();
mysql_query("INSERT INTO `zur` set `kto` = ".$user['id'].", `name` = 'улучшил замок', `time` = '".$t."', `clan`='".$user['clan']."'");
mysql_query("UPDATE `clan` SET `gold`='".$gold."', `max_kol`=`max_kol`+'10', `castle`='".$d."'  WHERE `id`='".$user['clan']."'");
header("Location: /clan/castle?id=".$clan['id']."");
$_SESSION['message'] = "<font color='94ED18'> Замок повышен до ".$d." уровня </font>";

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