<?php
include_once ('./core/base.php');
falseauth();

$id = fl($_GET['id']);

$clan_q = $base -> query('SELECT * FROM `clans` WHERE `id` = "'.$id.'" LIMIT 1');
$clan_nr = $clan_q -> num_rows;

if($clan_nr > 0){

$clan = $clan_q -> fetch_assoc();

$header = ''.$clan['name'].'';
include_once ('./core/head.php');

echo '<div class="b"><div class="title">'.$clan['name'].'</div>';

echo ''.clan($clan['id']).'';

echo '<div class="line"></div>';
echo '<center><font color="#E0E0E0">'.$clan['announcement'].'</font></center>';
echo '<div class="line"></div>';

echo '<div class="title">Состав клана</div>';

$count = $base->query("SELECT * FROM `users` WHERE `clan` = '".$clan['id']."'") -> num_rows;
$k_page = k_page($count,10);
$page = page($k_page);
$start = 10*$page-10;
$sql = $base->query("SELECT * FROM `users` WHERE `clan` = '".$clan['id']."' ORDER BY `clan_exp` DESC LIMIT $start,10");
if($count > 0){
	while($member = $sql -> fetch_assoc()){
		if($member['clan_rank'] == 4) $rank = ' <b>Лидер</b>';
		else $rank = '';
		$member_avatar='/images/skins/'.$member['skin'].'_big.png';
			echo '<a class="btn" href="/user/'.$member['id'].'/"><img src="'.$member_avatar.'" width="24px"> '.nolinkname($member['id']).' <img src="/images/icons/exp.png"><b>'.n_f($member['clan_exp']).''.$rank.'</b></a>';
		}
	if($count > '10'){
		echo str('?',$k_page,$page);
	}
}else{
	echo '<br/><center>В клане нет участников.</center><br/>';
}

echo '<br/><a class="btn" href="javascript:history.go(-1)"><img src="/images/icons/back.png"> Назад</a>';

echo '</div>';

}else{
	header('Location: /');
	exit;
}

include_once ('./core/foot.php');
?>