View file sdark.mobi/clan/up_altar.php

File size: 1.66Kb
<?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['altar']+1;
if($clan['altar']==1){$st=400; $mest=5;}
if($clan['altar']==2){$st=800; $mest=10;}
if($clan['altar']==3){$st=1700; $mest=15;}
if($clan['altar']==4){$st=4200; $mest=20;}
if($clan['altar']==5){$st=9500; $mest=25;}
if($clan['altar']==6){$st=16600; $mest=30;}
if($clan['altar']==7){$st=25000; $mest=35;}
if($clan['altar']==8){$st=34000; $mest=40;}
if($clan['altar']==9){$st=49600; $mest=45;}
if($clan['altar']==10){$st=68000; $mest=50;}
if($clan['altar']==11){$st=80000; $mest=55;}
if($clan['altar']==12){$mest=60;}
$st=floor($st*0.80);
$goldd=$st*100;
if($clan['gold']<$goldd){
header("Location: /clan/altar?id=$clan[id]");
$_SESSION['err'] = 'Недостаточно золота';exit;}
if($user['dolz']!='основатель'){$_SESSION['err'] = "Ошибка";
header('Location: /clan/altar?id='.$clan['id'].'');
exit();}
if($clan['altar']>=12){$_SESSION['err'] = "Ошибка";
header('Location: /clan/altar?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', `altar`='$d', `altar_bon`='$mest'  WHERE `id`='$user[clan]'");
header("Location: /clan/altar?id=$clan[id]"); 
$_SESSION['message'] = "<font color='94ED18'> Алтарь повышен до $d уровня </font>";

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