<table width="100%" border="0" cellspacing="2" cellpadding="2">	
   <?php 
 	$query = "Select player.id,player.name,player.level,player.exp,player.job,player.gold,player.playtime,player_index.empire,guild.name AS guild_name
  FROM player.player 
  LEFT JOIN player.player_index 
  ON player_index.id=player.account_id 
  LEFT JOIN player.guild_member 
  ON guild_member.pid=player.id 
  LEFT JOIN player.guild 
  ON guild.id=guild_member.guild_id
  INNER JOIN account.account 
  ON account.id=player.account_id
  WHERE player.name NOT LIKE '[%]%' AND account.status!='BLOCK'

  ORDER BY level DESC, exp DESC, playtime DESC limit 0,10"; 	  
	  $i = "0" ;  
	  
 $doQuery = mysql_query($query) or die(mysql_error());
while($getPlayers = mysql_fetch_object($doQuery))
   {
   $i = $i + 1 ;
  
   $cache_content .= '
<div class="tr">
<span class="t-rank">'. $i .'</span>
<span class="t-name"><a href="index.php?page=highscore" class="fui txt" $first>'.$getPlayers->name.'</a></span>
<span class="t-lvl"><a class="fui txt"><img src="resurse/imagini/regate/'.$getPlayers->empire.'.png" border="1px" width="22px" height="15px"/></a></span>
</div>';

}

if ( !file_exists('inc/player_cache.txt'))
 {
$q1_cache = fopen('inc/player_cache.txt', 'w');
fwrite($q1_cache, $cache_content);
fclose($q1_cache);
 }
 else
 {
	 if (filemtime('inc/player_cache.txt') < (time() - 7200))
	 {
		unlink('inc/player_cache.txt');
		$q1_cache = fopen('inc/player_cache.txt', 'w');
		fwrite($q1_cache, $cache_content);
		fclose($q1_cache);
	 }
	 else
	 {
		 $q1_cache = fopen('inc/player_cache.txt', 'r');
		 $cache_content = fread($q1_cache, filesize('inc/player_cache.txt') + 1);
		 fclose($q1_cache);
		 echo $cache_content;
	 }
 }
	


				?> </table>
	