<?php
	
	require_once '../includes/start.php';
	require_once '../includes/function.php';
	require_once '../includes/header1.php';

if($level==0 OR $ban!=0){
   		echo "<title>Доступ закрыт!!!</title>";
	 	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	 	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
		echo '<div class="blok3"><img src="/images/errors.png" width="200px"/></div><div class="blok3"><b>Вы не авторизованный или заблокированный пользователь или вы не достигли условий для доступа на страницу!!!</b><br/><a href="/?sign_in=1"><font color="#4EEE94"><b>Авторизуйтесь</font></a></b> или <a href="/reg.php"><font color="#4EEE94"><b>Зарегистрируйтесь</b></font></a></div>';

}else{
	$rs=check($_GET['rs']);
	if($rs=='' OR $rs>3 OR $rs<1)$rs=$rasa;
	$rswiew=''.check($rs).'';
	if($rs==4)$rswiew='0';
	switch ($act) {
	default:
	echo "<title>Рейтинг</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /><a href="?"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=old&amp;rs='.$rs.'"><b>Самые старые игроки</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=planet&amp;rs='.$rs.'"> <b>Больше всего планет</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=res&amp;rs='.$rs.'"><b>Больше всего ресурсов</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=people&amp;rs='.$rs.'"> <b>Самые населенные планеты</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).'<a href="?act=hero&amp;rs='.$rs.'"><b>Самые развитые герои</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=runit&amp;rs='.$rs.'"><b>Самые развитые войска</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=uarmy&amp;rs='.$rs.'"><b>Самые большие отряды</b></a></div><div class="razd"></div><div class="razd"></div>';
	echo '<div class="blok1">'.rasa($rs).' <a href="?act=moon&amp;rs='.$rs.'"><b>Самые большие луны</b></a></div>';
	break;
	case 'old':
	echo "<title>Самые старые игроки</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=old&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=old&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=old&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые старые игроки:</b></div></center><div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `users` WHERE `game`!=0 AND `rasa`='".$rswiew."' ORDER BY `newtime` ASC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' <a href="../p/anketa.php?id='.$row['id'].'"> <span class="'.crasa($row['rasa']).'">'.$row['login'].'</span></a> (нач. '.dates($row['newtime']).')<div class="dashed"></div></div></center>';
			
	}

	}

	break;
	case 'planet':
	echo "<title>Больше всего планет</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a> <br/><img src="../images/race/people.png" alt="image" /> <a href="?act=planet&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=planet&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=planet&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Больше всего планет:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `users` WHERE `game`!=0 AND `rasa`='".$rswiew."' ORDER BY `planet` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' <a href="../p/anketa.php?id='.$row['id'].'"> <span class="'.crasa($row['rasa']).'">'.$row['login'].'</span></a> ('.$row['planet'].' планет)<div class="dashed"></div></div></center>';
			
	}

	}

	break;
	case 'res':
	echo "<title>Больше всего ресурсов</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=res&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=res&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=res&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Больше всего ресурсов:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `users` WHERE `game`!=0 AND `rasa`='".$rswiew."' ORDER BY `min`+`gas`+`kred`+`prov`+`metall`+`water` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' <a href="../p/anketa.php?id='.$row['id'].'"> <span class="'.crasa($row['rasa']).'">'.$row['login'].'</span></a> ('.($row['gas']+$row['min']+$row['kred']+$row['prov']+$row['metall']+$row['water']).' ед.)<div class="dashed"></div></div></center>';
			
	}

	}
	break;
		case 'people':
	echo "<title>Самые населенные планеты</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=people&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=people&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=people&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые населенные планеты:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `planet` WHERE `rasa`='".$rswiew."' ORDER BY `peo` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			$q = mysql_query("SELECT * FROM `users` WHERE `id`='".$row['uid']."'");
			$u = mysql_fetch_array($q);
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' <a href="../game/sector.php?x='.$row['x'].'&amp;y='.$row['y'].'"><span class="'.crasa($row['rasa']).'">'.$row['name'].'</span></a> игрока <a href="../p/anketa.php?id='.$row['uid'].'"> <span class="'.crasa($row['rasa']).'">'.$u['login'].'</span></a> ('.$row['peo'].' населения)<div class="dashed"></div></div></center>';
			
	}

	}
	break;
	case 'hero':
	echo "<title>Самые развитые герои</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=hero&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=hero&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=hero&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые развитые герои:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `users` WHERE `game`!=0 AND `rasa`='".$rswiew."' AND `hero`!='' ORDER BY `lvl_hero` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' Герой <span class="'.crasa($row['rasa']).'">'.$row['hero'].'</span> игрока <a href="../p/anketa.php?id='.$row['id'].'"> <span class="'.crasa($row['rasa']).'">'.$row['login'].'</span></a> ('.$row['lvl_hero'].' уровень)<div class="dashed"></div></div></center>';
			
	}

	}
	break;
	case 'runit':
	echo "<title>Самые развитые войска</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=runit&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=runit&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=runit&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые развитые войска:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `units` WHERE `rasa`='".$rswiew."' ORDER BY `r1`+`r2`+`r3`+`r4`+`r5`+`r6`+`r7`+`r8`+`r9`+`r10`+`r11`+`r12` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			$q = mysql_query("SELECT * FROM `users` WHERE `id`='".$row['uid']."'");
			$u = mysql_fetch_array($q);
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' Войска игрока <a href="../p/anketa.php?id='.$row['uid'].'"> <span class="'.crasa($row['rasa']).'">'.$u['login'].'</span></a> (сум.ранг '.($row['r1']+$row['r2']+$row['r3']+$row['r4']+$row['r5']+$row['r6']+$row['r7']+$row['r8']+$row['r9']+$row['r10']+$row['r11']+$row['r12']).' ед.)<div class="dashed"></div></div></center>';
			
	}

	}
	break;	
		case 'uarmy':
	echo "<title>Самые большие отряды</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=uarmy&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=uarmy&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=uarmy&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые большие отряды:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `army` WHERE `rasa`='".$rswiew."' ORDER BY `u1`+`u2`+`u3`+`u4`+`u5`+`u6`+`u7`+`u8`+`u9`+`u10`+`u11`+`u12` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			$q = mysql_query("SELECT * FROM `users` WHERE `id`='".$row['uid']."'");
			$u = mysql_fetch_array($q);
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' Отряд <span class="'.crasa($row['rasa']).'">'.$row['name'].'</span>  игрока <a href="../p/anketa.php?id='.$row['uid'].'"> <span class="'.crasa($row['rasa']).'">'.$u['login'].'</span></a> ('.($row['u1']+$row['u2']+$row['u3']+$row['u4']+$row['u5']+$row['u6']+$row['u7']+$row['u8']+$row['u9']+$row['u10']+$row['u11']+$row['u12']).' юнитов)<div class="dashed"></div></div></center>';
			
	}

	}
	break;	
	case 'moon':
	echo "<title>Самые большие луны</title>"; 
	echo "<script type=\"text/javascript\">createPopup().show( 0, 0, 0, 0, 0 );</script>";
	echo "<body oncontextmenu=\"return false;\"><body onselectstart='return false' oncopy='return false'><body onselectstart=\"return false\" oncopy=\"return false\"><body onload=\"digitalWatch()\">";
	echo '<div class="razd"></div>';
	echo '<div class="top-nav1"><img src="../images/rate.gif" alt="image" /> <a href="?rs='.$rs.'"><b>Рейтинг</b></a><br/><img src="../images/race/people.png" alt="image" /> <a href="?act=moon&amp;rs=1"><b>Люди</b></a> <img src="../images/race/cyborgs.png" alt="image" /> <a href="?act=moon&amp;rs=2"><b>Киборги</b></a> <img src="../images/race/organ.png" alt="image" /> <a href="?act=moon&amp;rs=3"><b>Органики</b></a></div>';
	echo '<div class="razd"></div>';
	echo '<center><div class="blok1"><b>Самые большие луны:</b></div></center>';
	echo '<div class="razd"></div>';
	$PAGINGS = mysql_query("SELECT * FROM `moon` WHERE `rasa`='".$rswiew."' ORDER BY `diameter` DESC LIMIT 10");
	if($PAGINGS > 0)
	{
		while($row = mysql_fetch_array($PAGINGS))
		{

			
			$q = mysql_query("SELECT * FROM `users` WHERE `id`='".$row['uid']."'");
			$u = mysql_fetch_array($q);
			echo '<center><div class="window1"><div class="dashed"></div>'.rasa($row['rasa']).' Луна планеты <span class="'.crasa($row['rasa']).'">'.$row['name_planet'].'</span>  игрока <a href="../p/anketa.php?id='.$row['uid'].'"> <span class="'.crasa($row['rasa']).'">'.$u['login'].'</span></a> ('.$row['diameter'].' км)<div class="dashed"></div></div></center>';
			
	}

	}
	break;	
	}
}
	echo '<div class="razd"></div>';
	echo '<center><div class="blok2"><a href="../"><b>На Главную</b></a></div></center>';
	echo '<div class="razd"></div>';
	require_once '../includes/footer1.php';
?>