<?
define('PROTECTOR', 1);

$headmod = 'clanroom';//фикс. места

$textl='Клан';
@include('files/db.php');
@include('files/auth.php');
@include('files/func.php');
@include('files/core.php');
@include('files/head.php');
@include('files/zag.php');
if(empty($_GET[id])){echo"Невыбран клан"; include('files/down.php'); exit;}
$req = mysql_query("SELECT * FROM `clan` where `id`='$_GET[id]'");
$avto=mysql_num_rows($req);if($avto==1){
$clan = mysql_fetch_array($req);
$req = mysql_query("SELECT * FROM `users` where `money` and `clan`='$clan[lider]'");
$money = mysql_num_rows($req);
$req = mysql_query("SELECT * FROM `users` where `exp` and `clan`='$clan[lider]'");
$req = mysql_query("SELECT usr FROM `users` where `clan`='$clan[lider]'");

////////////////////////////
$kk=mysql_num_rows($req);
}else{
echo"Невыбран клан";include('files/down.php'); exit;}
//Модификация, кол-во опыта на следующий уровень
if($clan[level] == 0){$o = 750000;$nlvl = $o-$clan[exp];}
if($clan[level] == 1){$o = 2500000;$nlvl = $o-$clan[exp];}
if($clan[level] == 2){$o = 4000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 3){$o = 6000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 4){$o = 10000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 5){$o = 15000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 6){$o = 21000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 7){$o = 28000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 8){$o = 36000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 9){$o = 45000000;$nlvl = $o-$clan[exp];}
if($clan[level] == 10){$o = 100000000;$nlvl = $o-$clan[exp];}

switch($_GET[mod]){

default:
$procent=round(($clan[exp]/$o)*100,2);
$reit=($clan[exp]/50000)+($kk/10)+$clan[money]/2000;
$reiting = round($reit, 2);
echo"<font color='#f1d99a'><b>Клан: \"$clan[name]\" </b><br/></font></div><div class='menu'>";
if(empty($clan[logo])){echo"<img class='float-left' src='pic/clan/logo/0.jpg'/>";}else{echo"<img class='float-left' src='pic/clan/logo/$clan[logo]'/>";}
echo"<img src=\"pic/clan/$clan[emblema]\" alt=\"\"/> <b>$clan[name]</b></br>
<img src=\"pic/up.png\" alt=\"\"/> Уровень: <b>$clan[level]</b></br>
<img src=\"pic/clan/exp.png\" alt=\"\"/> Опыт: <b>$clan[exp]</b> <font color='grey'>($procent%)</br></font>";
echo"</div><div class='menus'>Рейтинг: <b>$reiting</b> <a href=\"library.php?id=31&lb=list_library\"> [i]</a><br/>";
echo"Информация: <b>$clan[desk]</b><br/>";
echo"Капитал: <b>$clan[money]</b><br/>";
echo"Бойцов: <b>$kk</b><br/>";
echo"Лидер: <a href=\"search.php?nick=$clan[lider]&amp;go=go\">$clan[lider]</a><br/>";
echo"</font><b>Список бойцов</b>:";
$req = mysql_query("SELECT clan,usr,lvl FROM `users` where `clan`='$clan[lider]' and `usr`!='$clan[lider]' ORDER BY lvl DESC");
////////////////////////////
$avto=mysql_num_rows($req);
$i=1;
if($avto>=1){
While($cl = mysql_fetch_array($req))
{
echo"<br/>$i. <a href=\"search.php?nick=$cl[usr]&amp;go=go\">$cl[usr]</a> [$cl[lvl] уровень]";
$i++;}}else{
echo"<br/>$i. <a href=\"search.php?nick=$clan[lider]&amp;go=go\">$clan[lider]</a>";}
$req = mysql_query("SELECT * FROM `clan` WHERE `lider` = '$log'");
////////////////////////////
$lider=mysql_num_rows($req);


if($lider==0 and empty($udata[clan]) and $clan[set_d]==0){
echo"</br>Клан закрыт</br><a href=\"msg.php?user=$clan[lider]&mod=answer\">Подать заявку в клан</a><br/>";}
if($lider==0 and empty($udata[clan]) and $clan[set_d]==1){
echo"</br>Клан открыт</br><a href=\"home.php?mod=vxod&lider=$clan[lider]\">Вступить</a><br/>";}
break;}

@include('files/down.php');
?>