<?php
include '../system/bd.php';
include '../system/cook.php';
include ("../system/gzip.php");
if(isset($_SESSION['auth']) && $_SESSION['auth']==1){
include '../system/head.php';
include '../system/head1.php';
$req = mysql_query("SELECT * FROM `user` WHERE `id` = '$user[id]'");
////////////////////////////
$avto=mysql_num_rows($req);
if($avto=="0"){
echo'Ошибка 1';
include 'inc/nogi.php';
exit;
}
$us = mysql_fetch_array($req);
if(empty($us[clan])){
echo' <div class="title">Ошибка</div>
<div class="empty_block item_center"> Вы не состоите в банде! </div>';
echo'<div class="block_link">';
echo"<a href='../index.php'> <img src ='../img/images/arrow.png'> Вернуться</a></div>";
include '../system/foot.php';
exit;}
/////////////

if($us[clan]!="$clans[id]"){

$req = mysql_query("SELECT * FROM `clans` where `id`='$us[clan]' or `leader`='$us[clan]' ");

$req = mysql_query("SELECT * FROM `clans` where `id`='$us[clan]' or `leader`='$us[clan]' ");

$avto=mysql_num_rows($req);
if($avto==1){
$clan1 = mysql_fetch_array($req);
$req = mysql_query("SELECT `id` FROM `user` where `clan`='$clan1[id]'");



////////////////////////////
$kk=mysql_num_rows($req);


echo '' ;

switch($_GET[id]){
default:

echo"<div class='title'>Умения казна</div>";

echo'    <div class="block_link light_bottom">
        <a href="spells.php?id=1">
            <table>
                <tbody><tr>
                    <td class="b66px">
                        <img src="/web/img/orden_spells/1.png" class="bord">
                    </td>
                    <td>
                        <span class="white"><b>Алтарь силы</b></span>
                        <div class="progress-black bord" style="width: 50%;">
                            <div class="progress-green" style="width:45%;"></div>
                        </div>
                                                   <span class="gray"> Бонус к каждому параметру игрока</span> <span class="lime">+360</span>
                                                                                                                                            </td>
                </tr>
            </tbody></table>
        </a>
    </div>';

echo'    <div class="block_link light_bottom">
   <a href="spells.php?id=2">
<table><tbody><tr>
<td class="b66px">
<img src="/web/img/orden_spells/1.png" class="bord">
</td><td>
<span class="white">
<b> Алтарь</b></span>
<div class="progress-black bord" style="width: 50%;">
<div class="progress-green" style="width:45%;"></div>
</div>
<span class="gray"> Бонус к каждому параметру игрока 
</span> <span class="lime"> 0 
</span>                                                                                                                        </td></tr>
</tbody></table>
</a> </div>';
break;

case'1':
echo"<div class='title'> Характеристики </div>";

echo ' <div class="bor1"><div class="bor2"><div class="bor3"><div class="bor4"><div class="bor_bg item_center"> ';
echo"<center> 
<img src='../img/icon/gold.png' alt='*'/> ".number_format ($clan1[gold])." 
 <img src='../img/icon/silver.png' alt='*'/> ".number_format ($clan1[silver])."
</center>";
echo ' </div> </div> </div> </div></div>';




if($clan1[attack]=="10"){
$cena=0;
}else{
$cena=$clan1[attack]*5;
}




if (('chat_clear') && isset($_GET['act']) && $_GET['act']=='1')
{
$req = mysql_query("SELECT * FROM `clans` WHERE `id` = '$user[clan]'");
////////////////////////////

header("Location: ?");

if($clan1[gold]<$cena){
echo "<img src='/pic/main/nou.png' alt='*'/> Маловато золота в общаке!<hr>";
}else{
mysql_query("UPDATE `clans` SET
`attack`=`attack` + '10',
`def`=`def` + '10',
`gold`=`gold`- '$cena' WHERE `id`='$user[clan]' LIMIT 1 ");

header ("Location: ?id=1"); exit;
}
}

echo" <div class='empty_block item_center'>
<img src='/img/icon/hp.png' alt='*'/> $clan1[hp] 10
<img src='/img/icon/attack.png' alt='*'/> $clan1[attack]
<img src='/img/icon/def.png' alt='*'/> $clan1[def] </br>
<small> (Бонус к каждому параметру за улучшение <font color='lime'> 10 </font>) </small> </br>
<a href='?id=1&act=1'>
<input type='submit' value='Повысить за $cena' class='button'>  </div> </a>";

echo'<div class="block_link">';
echo"<a href='spells.php'> <img src ='../img/images/arrow.png'> Вернуться</a></div>";
break;
             //////////




}
} else{
echo"Ошибка 3";
include '../system/foot.php';
exit;}
}
//////////////////

}else{
header ("Location: index.php"); exit;
}
include '../system/foot.php';
?>
