<?
ob_start();
require'../sys/head.php';
require'../sys/conf.php';
require'../sys/sess.php';
require'../otsev.php';
echo"<u>Все кланы Державы:</u><br/>";
if(!empty($_GET['d'])){$d = $_GET['d'];} else {$d = '';}
switch($d){
default:
$sum = 2500000; // число записей на странице
$result = mysql_query("SELECT count(*) as a from klan"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];
if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;
$r = mysql_query("SELECT * FROM klan LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){
////////////////вывод
$m= mysql_fetch_array($r);$id=$m['id'];		   
echo'{<a href="stkl.php?der='.$key.'&d=1&id='.$id.'">'.$m[name].'</a>}('.$m[zah].' захв.)<br/>';
////////////////
}	   
break;
case'1':
$id=$_GET['id'];
$kl=mysql_fetch_array(mysql_query("SELECT * FROM klan WHERE id='$id'"));
echo"<u>Kлан</u><br/><b>$kl[name]</b><br/><u>Основан ($kl[time])</u><br/>";
echo"$kl[logo]<br/>";echo"<u>Состав клана:</u><br/>";
//////////////////
$sum = 25000; // число записей на странице
$result = mysql_query("SELECT count(*) as a from users WHERE klan='$id'"); 
$arr = mysql_fetch_row($result);$rec = $arr[0];
if(!isset($_GET['str'])){$str = 0;}else
{$str = $_GET['str'];}$start = $str * $sum;
$r = mysql_query("SELECT login FROM users WHERE klan='$id' LIMIT $start, $sum");
$n = mysql_num_rows($r);for ($i = 0; $i < $n; $i++){
////////////////вывод
$m= mysql_fetch_array($r);
$kl1=mysql_fetch_array(mysql_query("SELECT strana FROM gos WHERE login='$m[login]'"));
if(!empty($kl1[strana])){		   
echo"$kl1[strana],";}}

echo"<br>Kланом уничтожено <b>$kl[zah]</b> стран!<br/>";
echo"<u>Девиз:</u><br/>$kl[deviz]<br/>";echo"<u>Информация:</u><br/>$kl[info]<br/>";
//////////////////////////////////////////////////////////////////////////////////////////////////

break;
}
echo'<br/><a href="../game.php?der='.$key.'">В страну</a><br/>';
echo'</div><div class="knews"><a href="../out.php?der='.$key.'">Выход</a><br/>';
require'../sys/foot.php';
?>