<?php
define('PROTECTOR', 1);
include('files/path.php');
include($path.'files/db.php');
include($path.'files/auth.php');
include($path.'files/func.php');
include($path.'files/core.php');
$textl='Банда';
include($path.'files/head.php');
include($path.'files/zag.php');

if(empty($_GET['id'])){
echo'<div class="main"><div class="block_zero center">Не выбрана банда!</div></div>';
include($path.'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'<div class="main"><div class="block_zero center">Не выбрана банда!</div></div>';
include($path.'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);

echo'<div class="main"><div class="block_zero">';
if(empty($clan['logo'])){
echo'<img class="float-left" src="image/clan/gerb/0.png" width="50" height="50" style="margin-left:1px; margin-right:10px;" alt="*">';
}else{
echo'<img class="float-left" src="image/clan/gerb/'.$clan['logo'].'" width="50" height="50" style="margin-left:1px; margin-right:10px;" alt="*">';
}
echo"<img src=\"image/clan/$clan[emblema].png\" alt=\"\"/> <b>$clan[name]</b></br>
<img src=\"image/icon/level.png\" alt=\"\"/> Уровень: $clan[level]</br>
<img src=\"image/icon/exp.png\" alt=\"\"/> Авторитет: $clan[exp]/$o<font color='grey'> ($procent%)</font>";

$exp=$clan['exp']/$o*100;
echo'<div class="stat_bar"><div class="progress" style="width:'.$exp.'%"></div></div>';

echo'</div><div class="mini-line"></div><div class="block_zero">';

echo"Рейтинг: $reiting<br/>";
echo"Описание: $clan[desk]";

echo'</div><div class="mini-line"></div><div class="block_zero">';

echo"Сигареты: $clan[money]<br/>";
echo"Рубли: $clan[almaz]<br/>";

echo"Состав банды ($kk):<br/>";
echo"Лидер: <a href=\"search.php?nick=$clan[lider]&amp;go=go\">$clan[lider]</a><br/>";
$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 AND $udata['storona']==$clan['emblema']){
echo"</br>Открытая банда</br><a href=\"home.php?mod=vxod&lider=$clan[lider]\">Вступить</a><br/>";
}
break;
}
echo'</div></div>';
include($path.'files/down.php');
?>