
<?php
include 'core/system.php';


reg();
head('Клан');

?><style>
.chapter{display:block;height:62px;margin:2px 0;border:1px solid #20232c;border-radius:7px;background-position:2px center,right 2px center;background-repeat:no-repeat,no-repeat}
.b_dung_chapter .chapter._d1{background-image:url(/img/new/anow.jpg),url(/img/new/bg_right.jpg)}

.b_dung_chapter .chapter>span{display:block;height:62px;padding:10px 10px 0 0;text-align:right;font-size:17px;color:#3b9de2}.b_dung_chapter .chapter span small{color:#56585a}.b_dung_chapter .chapter span._p1 .type{color:#9ca2a9}.b_dung_chapter .chapter span._p2 .type{color:#52c13d}.b_dung_chapter .chapter span._p3 .type{color:#3087f7}.b_dung_chapter .chapter span._p4 .type{color:#8926ff}.b_dung_chapter .chapter span._p5 .type{color:#ff7412}.b_dung_chapter .chapter span._p6 .type{color:red}.b_dung_chapter .chapter._disabled{opacity:.5}.b_dung_chapter .chapter._disabled span *{color:#9ca2a9 !important}
.pda_new {
-webkit-animation: pda_new 1s linear infinite;
animation: pda_new 2s linear infinite;


}
@-webkit-keyframes pda_new {
from {color: #9933ff}

to {color: #222}
}
@keyframes pda_new {
from {color: #9933ff}

to {color: #222}
}
.pda_new {
box-shadow: 0 0 90px;







border: #000 -6px solid;

padding:3px;
margin-left:7px;


margin-right:7px;


border-top-right-radius:5px;

border-top-left-radius:5px;

-moz-border-top-right-radius:4px;


-moz-border-top-left-radius:5px;

border-bottom-right-radius:5px;

border-bottom-left-radius:5px;

-moz-border-bottom-right-radius:5px;

-moz-border-bottom-left-radius:5px;

}
 a { 
    text-decoration: none; /* Отменяем подчеркивание у ссылки */
   } 
.ggt {
    position: absolute; /* Абсолютное позиционирование */
    bottom: 15px; /* Положение от нижнего края */
    right: 15px; /* Положение от правого края */
    line-height: 1px;
   }
.hhm {
    top: 0px;
    right: 0px;
    width: 53px;
    height: 16px;
    position: absolute;
    margin-top: 5px;
    display: block;
}
</style><? 
$clans = $dbc->query("SELECT * FROM `clan` WHERE `id`='".$user['clan']."' LIMIT 1")->fetch_assoc();
$clan_id = $clans['id'];
if($user['clan']<=0){ header('location: clan.php');exit; }

//if($user['id']>1){ header('location: clan.php');exit; }


$gold  = 1500;
$sera   = 1000000;

$dont = $clans['kuz']*20;


$param  = 30 + $dont;



$gold_up  = 1000*$clans['kuz'];
$sera_up   = 500000*$clans['kuz'];
$paykamen  = 300*$clans['kuz'];

if(isset($_GET['journal'])){



$journal_q = $dbc->query("SELECT * FROM `clan_stone` WHERE `clan`='".$user['clan']."' ORDER BY `time` DESC LIMIT ".$page.",".$set['str']."");




$total = $dbc->query("SELECT `id` FROM `clan_stone` WHERE `clan`='".$user['clan']."'"); $total = $total->num_rows;


if($total==0){
echo '<div class="main">

<div class="block_zero center">Журнал клана пуст</div></div>';
foot();
exit;
}

while($row = $journal_q->fetch_assoc()){ 



echo '
<div class="b-panel-new dblue-panel bordered mt2"><div class="panel-inner-2"><small>




'.$row['text'].' (<span class="info">'.clock($row['time']).'</span>)


</small>
</div></div>

';
    } 


if($total > $set['str'])
    {
        pages($page, $total, 'clan_kuz.php?journal&', $set['str']);



    }
    echo '</div></div>'; 

?><center><a href="clan_kuz.php"><input class="btn big" type="submit" value="Кузница"></a></center></a><?
foot();exit;

}

if(isset($_GET['stone'])){ 





if($clans['kuz']<=0){  header('location:clan_kuz.php');exit;}

$paykamen  = 300*$clans['kuz'];
if($user['gold']<$paykamen){  header('location:clan_kuz.php');exit;}


$dbc->query("UPDATE `users` SET `gold`=`gold`-$paykamen WHERE `id`='".$user['id']."'");



$dbc->query("INSERT INTO `stone_bag` (user_id,status,name,strong,hp,prot,img,lite,level) values('".$user['id']."',1,'Камень Союза','".$param."','".$param."','".$param."',3,'iEpic',1)"); 


        
$dbc->query("INSERT INTO `clan_stone` SET `clan`='".$clan_id."', `user`='".$user['id']."', `text`='<img src=img/class/".$user['storona']."/".$user['pers']."/pers.png><a href=\"pers.php?ank=".$user['id']."\">".$user['login']."</a> Создал <span class=iEpic>Камень Союза</span>',        `time`='".time()."'");







$_SESSION['message']='Камень Успешно Создан';
 header('location:clan_kuz.php');exit;} 



if(isset($_GET['bul'])){ 





if($clans['kuz']>0){  header('location:clan_kuz.php');exit;}


if($clans['kazna']<$gold){  header('location:clan_kuz.php');exit;}

if($clans['sera']<$sera){  header('location:clan_kuz.php');exit;}


$dbc->query("UPDATE `clan` SET `kuz`=`kuz`+1,`sera`=`sera`-'".$sera."' ,`kazna`=`kazna`-'".$gold."' WHERE `id`='".$clans['id']."' "); 



$_SESSION['message']='Успешно Построено';
 header('location:clan_kuz.php');exit;} 


if(isset($_GET['bul_up'])){ 






if($clans['kuz']==10){  header('location:clan_kuz.php');exit;}

if($clans['kuz']<=0){  header('location:clan_kuz.php');exit;}



if($clans['kazna']<$gold_up){  header('location:clan_kuz.php');exit;}


if($clans['sera']<$sera_up){  header('location:clan_kuz.php');exit;}



$dbc->query("UPDATE `clan` SET `kuz`=`kuz`+1,`sera`=`sera`-'".$sera_up."' ,`kazna`=`kazna`-'".$gold_up."' WHERE `id`='".$clans['id']."' "); 



$_SESSION['message']='Успешно Улучшено';
 header('location:clan_kuz.php');exit;} 



 


?>




<center><div class="example3"






style="text-align:center"><img src="/img/new/kuz.jpeg" width="100%"> 



<div class="example_text"> <a href="clan_kuz.php?journal">Журнал</a></div></div></center><?




if($clans['kuz']==0){ 



?><center>У вашего клана <span class="info">кузница</span> не построена</center><?



if($user['clan_rang']==5){ 
?><center>Стоимость постройки <img src="img/stat/sera.png">1000000 <img src="img/money/money.png">1500</center><? 


?><center><a href="clan_kuz.php?bul"><input class="btn big" type="submit" value="Построить"></a></center></a><?




}

foot();exit;}

elseif($clans['kuz']>0){ 



?><center>Кузница <span class="info"><?=$clans['kuz']?>ур.</span></center><?



if($user['clan_rang']==5){ 
?><center>Стоимость улучшения <img src="img/stat/sera.png"><?=$sera_up?> <img src="img/money/money.png"><?=$gold_up?></center><? 



?><center><a href="clan_kuz.php?bul_up"><input class="btn big" type="submit" value="Улучшить"></a></center></a><?


}










?><div class='pda_new'>

<table width="100%" height="100%" border="0" cellpadding="0" cellspacing="0">
                <tr> 


 <td width="10"><img src="/img/stone/3.png" width="50px" >   </td>   




<td width="10"><span class="iEpic">Камень Союза</span>

<td width="40"> </td>








        
 <td width="10"><img src="/img/stat/hp.png"><?=$param?></td>








 <td width="10"><img src="/img/stat/AKulak.png"><?=$param?></td>






 <td width="10"><img src="/images/icons/armor.png"><?=$param?></td>





 <td width="40" align="center"><a href="clan_kuz.php?stone">Создать Камень</a></td>





</tr></table>




</div><?




?><div class="b-panel-new dblue-panel bordered mt2">

<div class="panel-inner-2"><div class="font-small text-italic c-verygray">Стоимость создания камня <img src="img/money/money.png">
<?=$paykamen?></div></div></div><?













}


















foot();


