<?
if ($onl) {
if ($onl=='1') {
ai();
if (count($game["players"])>0) {
$stmp.="\n<br/><a href=\"$PHP_SELF?sid=$sid&onl=reit\">[рейтинг]</a>
<br/>Онлайн ".count($game["players"])." человек:";
$ind=0;
$count=0;
if ($start<0 || !$start) $start=0;
$online=array_keys($game["players"]);
foreach($online as $i) {
if ($ind>=$start) {
$dat=$game["loc"][$game["players"][$i]][$i]["data"];
if ($i!="user.") $stmp.="\n<br/><b><big>".$game["loc"][$game["players"][$i]][$i]["title"]."</big></b> ".$dat;
$count++;
if ($count>=$count_show) break; // след. страница, если слишком много человек или предметов
}
$ind++;
}
if ($start && $start-$count_show>=0) $stmp.="\n<br/><a href=\"$PHP_SELF?sid=$sid&onl=1&start=".($start-$count_show)."\">[-]</a>";
if ($count+$start<count($game["players"])) {if (!$start) $stmp.="\n<br/>"; $stmp.= " <a href=\"$PHP_SELF?sid=$sid&onl=1&start=".($count+$start)."\">[+]</a>";}
} else $stmp.="\n<br/>Сейчас в игре никого нет";
msg($stmp, "Онлайн");
}
if ($onl=='reit'){
ai();
$stmp='';
if (count($game["players"])>0) {
if($player['style']!=='0') $stmp.="<div class='main'>";
$stmp.="Рейтинг онлайн игроков:";
$ind=0;
$count=0;
if ($start<0 || !$start) $start=0;
$online=array_keys($game["players"]);
$reit=array();
foreach($online as $i) {
$st1=split("\|",$game["loc"][$game["players"][$i]][$i]["st"]);
$sum=$st1[2]+$st1[3];
$reit[$i]=$sum;
}
arsort($reit);
foreach(array_keys($reit) as $i) {
if ($ind>=$start) {
$m_st="";
if ($game["loc"][$game["players"][$i]][$i]["lag"]=="1") $m_st="[гор]";
if ($game["loc"][$game["players"][$i]][$i]["lag"]=="2") $m_st="[разб]";
if ( !isset($game["loc"][$game["players"][$i]][$i]["st"]) ) $game["loc"][$game["players"][$i]][$i]["st"]="0|0|0|0";
$st1=split("\|",$game["loc"][$game["players"][$i]][$i]["st"]);
$m_st.="<br/>Убито: $st1[2]ч. + $st1[3]м.";
$stmp.="\n<br/>+ ".$game["loc"][$game["players"][$i]][$i]["title"].$m_st;
$count++;
if ($count>=$count_show) break; // след. страница, если слишком много человек или предметов
}
$ind++;
}
if ($start && $start-$count_show>=0) $stmp.="\n<br/><a href=\"$PHP_SELF?site=reit&start=".($start-$count_show)."\">[-]</a>";
if ($count+$start<count($game["players"])) {if (!$start) $stmp.="\n<br/>"; $stmp.= " <a href=\"$PHP_SELF?site=reit&start=".($count+$start)."\">[+]</a>";}
} else $stmp.="Сейчас онлайн никого нет</div>";
msg($stmp,"Рейтинг");
}
if ($onl=='klan'){
require "dblogin.php";
if (!$klan_id){
$sql="SELECT * FROM old_klan_table WHERE 1";
$res = query($sql);
$num=mysql_num_rows($res);
if (!$num) msg("В игре нет ни одного клана","Кланы");
if($player['style']!=='0') $stmp.="<div class='main'>";
$stmp='Игровые кланы ('.$num.'):';
$klan_count=array();
$klan_info=array();
while ($data = mysql_fetch_array($res)){
$kl_id=$data["klan_id"];
$kl_name=$data["klan_title"];
$sql="SELECT * FROM old_klan_users WHERE klan_id='$kl_id' AND user_reit>'0'";
$res1 = query($sql);
$num1=mysql_num_rows($res1);
$klan_count[$kl_name]=$num1;
$klan_info[$kl_name]=$kl_id;
}
arsort($klan_count);
$ind=0;
$count=0;
if ($start<0 || !$start) $start=0;
foreach (array_keys($klan_count) as $i){
if ($ind>=$start) {
$stmp.="<br/><b>$i</b> <a href=\"$PHP_SELF?sid=$sid&onl=klan&klan_id=".$klan_info[$i]."\"> [".$klan_count[$i]."]</a>";
$count++;
if ($count>=7) break;
}
$ind++;
}
$stmp.="<br/>";
if ($start && $start-7>=0) $stmp.="<a href=\"$PHP_SELF?sid=$sid&onl=klan&start=".($start-7)."\">[назад]</a>";
if ($count+$start<$num) $stmp.= "<a href=\"$PHP_SELF?sid=$sid&onl=klan&start=".($count+$start)."\">[далее]</a></div>";
}//!$klan_id
else{
$sql="SELECT * FROM old_klan_table WHERE klan_id='$klan_id'";
$res = query($sql);
$num=mysql_num_rows($res);
if (!$num) msg("Нет такого клана.","Кланы",0,'none');
$data = mysql_fetch_array($res);
$klan_title=$data["klan_title"];
$sql="SELECT * FROM old_klan_users WHERE klan_id='$klan_id' AND user_reit>'0' ORDER BY user_reit DESC";
$res = query($sql);
$num=mysql_num_rows($res);
if($player['style']!=='0') $stmp.="<div class='main'>";
$stmp="Клан <b>".$klan_title."</b><br/>".$num." человек:";
while ($data = mysql_fetch_array($res)){
$user_title1=$data["user_name"];
$user_title=substr($user_title1,5);
$user_reit =$data["user_reit"];
$user_reit=str_repeat("*",$user_reit);
if ($game["players"]["".$user_title1.""]) $stmp.="<br/><b>".$user_title."</b> [".$user_reit."]";
else $stmp.="<br/>$user_title [$user_reit]";
}
}
msg($stmp,"Кланы",0,'none');
}
}
?>