<table width="100%" border="0" cellspacing="2" cellpadding="2">		
<?php 
$db	= "player";		
mysql_select_db($db) OR
die();
$query2 = "SELECT * FROM guild WHERE guild.name NOT LIKE 'STAFF' ORDER BY level desc, exp desc, exp desc, win desc, name asc limit 0,10";
$i = "0" ;
$doQuery2 = mysql_query($query2);
while($b = mysql_fetch_object($doQuery2))
{
	$i = $i + 1 ;
	$leader = $b->master;
	$reich = mysql_query("SELECT empire from player_index where pid1 = '$leader' OR pid2 = '$leader' OR pid3 = '$leader' OR pid4 = '$leader'");
	$reich2 = mysql_fetch_object($reich);
	$empire = $reich2->empire;	
	$cache_content2 .= '
<div class="tr">
<span class="t-rank">'. $i .'</span>
<span class="t-name"><a href="index.php?page=guildhighscore" class="fui txt">'.$b->name.'</a></span>
<span class="t-lvl"><a class="fui txt"><img src="resurse/imagini/regate/'.$reich2->empire.'.png" border="1px" width="22px" height="15px"/></a></span>
			</div>
	';
}
if (!file_exists('inc/bresle_cache.txt'))
{
	$b2_cache = fopen('inc/bresle_cache.txt', 'w');
	fwrite($b2_cache, $cache_content2);
	fclose($b2_cache);
}
else
{
	if (filemtime('inc/bresle_cache.txt') < (time() - 7200))
	{
		unlink('inc/bresle_cache.txt');
		$b2_cache = fopen('inc/bresle_cache.txt', 'w');
		fwrite($b2_cache, $cache_content2);
		fclose($b2_cache);
	
	}
	else
	{
		$b2_cache = fopen('inc/bresle_cache.txt', 'r');
		$cache_content2 = fread($b2_cache, filesize('inc/bresle_cache.txt') + 1);
		fclose($b2_cache);
		echo $cache_content2;	
	}
}
	


?>
</table>
	