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

head('Войско Клана');
reg(); 

if($user['clan_rang']<4){ header('location:index.php');exit;}
$clan = $dbc->query("SELECT * FROM `clan` WHERE `id`='".$user['clan']."' LIMIT 1")->fetch_assoc();

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

 if(empty($_POST['luk'])){
    header("Location: arm.php");
    }else{
        
    $luk = int($_POST['luk']); 



$cena_rubin = $luk*7;

$cena_sera = $luk*6000;

$sila  = $luk*700;





if($clan['rub']<$cena_rubin){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}



if($clan['sera']<$cena_sera){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}


 







$dbc->query("UPDATE `clan` SET `sera`=`sera`-'".$cena_sera."',`rub`=`rub`-'".$cena_rubin."',`luk`=`luk`+'".$luk."',`sila_arm`=`sila_arm`+'".$sila."',`col_arm`=`col_arm`+'".$luk."' WHERE `id`='".$user['clan']."'"); 









$dbc->query("INSERT INTO `clan_journal` SET `clan`='".$user['clan']."', `user`='".$user['id']."', `text`='<img src=img/class/".$user['storona']."/".$user['pers']."/pers.png><a href=\"pers.php?ank=".$user['id']."\">".$user['login']."</a> Нанял ".$luk." Лучников ' ,`time`='".time()."'"); 



$_SESSION['message']='Вы успешно Наняли Лучников'; header('location:arm.php');exit;}}  
if(isset($_GET['cop'])){ 

 if(empty($_POST['cop'])){
    header("Location: arm.php");
    }else{
        
    $cop = int($_POST['cop']); 



$cena_rubin = $cop*5;

$cena_sera = $cop*5000;

$sila  = $cop*500;




if($clan['rub']<$cena_rubin){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}



if($clan['sera']<$cena_sera){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}


 







$dbc->query("UPDATE `clan` SET `sera`=`sera`-'".$cena_sera."',`rub`=`rub`-'".$cena_rubin."',`cop`=`cop`+'".$cop."',`sila_arm`=`sila_arm`+'".$sila."',`col_arm`=`col_arm`+'".$cop."' WHERE `id`='".$user['clan']."'"); 


$dbc->query("INSERT INTO `clan_journal` SET `clan`='".$user['clan']."', `user`='".$user['id']."', `text`='<img src=img/class/".$user['storona']."/".$user['pers']."/pers.png><a href=\"pers.php?ank=".$user['id']."\">".$user['login']."</a> Нанял ".$cop." Копьеносцев ' ,`time`='".time()."'"); 


$_SESSION['message']='Вы успешно Наняли Копьеносцев'; header('location:arm.php');exit;}} 
if(isset($_GET['voin'])){ 

 if(empty($_POST['voin'])){
    header("Location: arm.php");
    }else{
        
    $voin = int($_POST['voin']); 



$cena_rubin = $voin*3;
$cena_sera = $voin*3000;
$sila  = $voin*300;



if($clan['rub']<$cena_rubin){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}



if($clan['sera']<$cena_sera){ $_SESSION['message']='недостаточно ресурсов'; header('location:arm.php');exit;}


 







$dbc->query("UPDATE `clan` SET `sera`=`sera`-'".$cena_sera."',`rub`=`rub`-'".$cena_rubin."',`voin`=`voin`+'".$voin."',`sila_arm`=`sila_arm`+'".$sila."',`col_arm`=`col_arm`+'".$voin."' WHERE `id`='".$user['clan']."'"); 


$dbc->query("INSERT INTO `clan_journal` SET `clan`='".$user['clan']."', `user`='".$user['id']."', `text`='<img src=img/class/".$user['storona']."/".$user['pers']."/pers.png><a href=\"pers.php?ank=".$user['id']."\">".$user['login']."</a> Нанял ".$voin." Воинов ' ,`time`='".time()."'"); 


$_SESSION['message']='Вы успешно Наняли Воинов'; header('location:arm.php');exit;}}



 

?><div class="cito-name">Войско Клана</div><?

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

<center><div class="panel-inner-2"><div class="font-small text-italic c-verygray"><span class="info"><img src="img/money/money.png"><?=$clan['kazna']?> <img src="img/stat/sera.png"><?=$clan['sera']?> <img src="img/money/rubin.png"><?=$clan['rub']?></span> </div></div></div></center><?





?><div class="b-panel-new dblue-panel bordered mt2"><table cellpadding="0" cellspacing="0" border="0">

<tbody>
<td valign="top"><img src="/img/arm/voin.png"  
style="box-shadow: 0px 0px 20px black; margin: 10px;"><span class="amu-lvl"><?=$clan['voin']?></span></td>










<td valign="top" style="padding-left:4px;">Воин</br><img src="img/stat/hp.png">2000</br><img src="img/stat/AKulak.png">300</br><img src="/images/icons/armor.png">500 </br>Стоимость: <img src="img/money/rubin.png">3 <img src="img/stat/sera.png">3000</td></tbody></table>


Выберите количество воинов для наема
    <form action="arm.php?voin" method="post">
<input id="login" type="text" class="input-area" value="" name="voin">




<div class="form-submit">
<div class="form-submit"><input type="submit" class="btn" value="Нанять"/>



</div>


</form>
</div>
</div>



</div><?













?><div class="b-panel-new dblue-panel bordered mt2"><table cellpadding="0" cellspacing="0" border="0">

<tbody>
<td valign="top"><img src="/img/arm/cop.png"  
style="box-shadow: 0px 0px 20px black; margin: 10px;"><span class="amu-lvl"><?=$clan['cop']?></span></td>










<td valign="top" style="padding-left:4px;">Копьеносец</br><img src="img/stat/hp.png">2500</br><img src="img/stat/AKulak.png">500</br><img src="/images/icons/armor.png">400 </br>Стоимость: <img src="img/money/rubin.png">5 <img src="img/stat/sera.png">5000</td></tbody></table>


Выберите количество копьеносцев для наема
    <form action="arm.php?cop" method="post">

<input id="login" type="text" class="input-area" value="" name="cop">




<div class="form-submit">
<div class="form-submit"><input type="submit" class="btn" value="Нанять"/>



</div>


</form>
</div>
</div>



</div><?



?><div class="b-panel-new dblue-panel bordered mt2"><table cellpadding="0" cellspacing="0" border="0">

<tbody>
<td valign="top"><img src="/img/arm/luc.png"  

style="box-shadow: 0px 0px 20px black; margin: 10px;"><span class="amu-lvl"><?=$clan['luk']?></span></td>










<td valign="top" style="padding-left:4px;">Лучник</br><img src="img/stat/hp.png">1500</br><img src="img/stat/AKulak.png">700</br><img src="/images/icons/armor.png">300 </br>Стоимость: <img src="img/money/rubin.png">7 <img src="img/stat/sera.png">6000</td></tbody></table>


Выберите количество лучников для наема
    <form action="arm.php?luk" method="post">

<input id="login" type="text" class="input-area" value="" name="luk">




<div class="form-submit">
<div class="form-submit"><input type="submit" class="btn" value="Нанять"/>



</div>


</form>
</div>
</div>



</div><?





















foot();