Просмотр файла sdark.mobi/clan/altar.php

Размер файла: 4.41Kb
<?php
require_once '../core/system.php';
echo only_reg();
echo ban();
if (isset($_GET['id']) && mysql_result(mysql_query("SELECT COUNT(*) FROM `clan` WHERE `id` = '".intval($_GET['id'])."'"),0) == true){
$clan = mysql_fetch_array(mysql_query("SELECT * FROM `clan` WHERE `id`  = ".intval($_GET['id']).""));
}else{
$_SESSION['err'] = "Ошибка";
header('Location: /');
exit();
}
$header = 'Постройки клана / Алтарь';
require_once H.'core/head.php';

if($clan['altar']==1){$st=400; $mest=0; }
if($clan['altar']==2){$st=800; $mest=5; $plus=0.05;}
if($clan['altar']==3){$st=1700; $mest=10; $plus=0.10;}
if($clan['altar']==4){$st=4200; $mest=15; $plus=0.15;}
if($clan['altar']==5){$st=9500; $mest=20; $plus=0.20;}
if($clan['altar']==6){$st=16600; $mest=25; $plus=0.25;}
if($clan['altar']==7){$st=25000; $mest=30; $plus=0.30;}
if($clan['altar']==8){$st=34000; $mest=35; $plus=0.35;}
if($clan['altar']==9){$st=49600; $mest=40; $plus=0.40;}
if($clan['altar']==10){$st=68000; $mest=45; $plus=0.45;}
if($clan['altar']==11){$st=80000; $mest=50; $plus=0.50;}
if($clan['altar']==12){$mest=55; $plus=0.55;}
$st=floor($st*0.80);

if(isset($_GET['activate'])){
if($user['gold']<100){
header("Location: /clan/altar?id=$clan[id]");
$_SESSION['err'] = ' Недостаточно золота';exit;}
if($clan['altar']<2){
header("Location:/clan/altar?id=$clan[id]");
$_SESSION['err'] = ' Ошибка';exit;}
if($user['clan']!=$clan['id']){
header("Location:/clan/altar?id=$clan[id]");
$_SESSION['err'] = ' Ошибка';exit;}
$health = floor($user['max_health']*$plus);
$sila = floor($user['sila']*$plus);
$zashit = floor($user['zashit']*$plus);
$req = mysql_query("SELECT * FROM `bonus` WHERE `usr` = '$user[id]' and `name` = 'Бонус алтаря'");
$avto = mysql_num_rows($req);
if($avto==0){
$t=time()+3600;
$altar = mysql_result(mysql_query("SELECT COUNT(*) FROM `logi` WHERE `user_id` = '".$user['id']."' and `text` = 'Алтарь'"),0);
if($altar==0){mysql_query("INSERT INTO `logi` set `user_id` = '".$user['id']."', `text` = 'Алтарь', `time` = '".time()."', `kol`='100', `kto`='-'");}else{
mysql_query("UPDATE `logi` set  `time` = '".$tm."', `kol`=`kol`+'100', `kto`='-' WHERE `user_id` = '".$user['id']."' and `text` = 'Алтарь'");}
mysql_query("UPDATE `user` set `max_health` = `max_health` + '$health',`sila` = `sila` + '$sila',`zashit` = `zashit` + '$zashit', `gold`=`gold`-'100' where `id` = '".$user['id']."'");
mysql_query("INSERT INTO `bonus` set `usr` = ".$user['id'].", `name` = 'Бонус алтаря',`kol`='$health;$sila;$zashit',`param`='all', `time` = '$t', `bonus`='+$mest% к параметрам', `image`='2',`typ`='0'");
}else{header("Location: /clan/altar?id=$clan[id]");
$_SESSION['err'] = ' У вас уже есть активированный бонус';exit;}
header("Location: /clan/altar?id=$clan[id]"); 
$_SESSION['message'] = "Бонус активирован";
}

echo"<div class='foot'><img src='/images/clan/altar.png' height='30' width='30'><font color='EBC958'> Алтарь </font><font color='#CDC9C9'>($clan[altar] ур.)</div></font><hr></font>";
echo"<div class='mli'><div class='empty2'></div><font color='ECE999'>От уровня постройки зависит бонус, увеличивающий параметры игроков, которые находятся в текущем клане.</font><div class='empty2'></div></div><hr> ";
if($user['clan']==$clan['id'] and $clan['altar']>1){echo" <div class='but-list-light'>
<a href=\"/clan/altar?id=$clan[id]&activate\"><img src=\"/images/main/clan.png\" > Активировать бонус <font color='#CDC9C9'>за <img src=\"/images/icon/gold.png\">1 на 60 мин. </font></a></div><hr>";}
if($clan['altar']<12 and $user['clan']==$clan['id'] and $user['dolz']=='основатель'){echo"<div class='but-list'>
<a href=\"/clan/up_altar\"><img src=\"/images/icon/level.png\" > Повысить уровень <font color='#CDC9C9'>за <img src=\"/images/icon/gold.png\">$st <font color='orange'>(+5%)</font></font>(<font color='F2F745'>-20%</font>)</a></div></div><hr>";//(<font color='F2F745'>-20%</font>)
}
if($clan['altar']>=12 and $user['clan']==$clan['id']){echo"<div class='foot'>Алтарь максимального уровня</div><hr>";}
echo"</div><div class='foot'> <font color='E1B63F'>Бонус постройки: <font color='#B1DF3D'>+$mest%</font> к параметрам
</font></font></font></div></div>";
require_once H.'core/foot.php';
?>