					<div class="postui post-title">
	<h2><span>CLASAMENTUL DE PE Metin2Alaska</span></h2>
</div>
<div class="postui post-con">
	<div class="con-wrap">
	<table width="100%">
		<tr>
			<td>
				<a class="btn-big2" href="index.php?page=highscore">Clasament Jucători</a>
			</td>
			<td>
				<a class="btn-big2" href="index.php?page=guildhighscore">Clasament Bresle</a>
			</td>
		</tr>	
	</table>
	</div>           
</div>
<div class="postui post-end"></div>

<div class="postui post-title">
	<h2><span>CLASAMENTUL JUCATORILOR</span></h2>
</div>

<div class="postui post-con">
	<div class="con-wrap">
					
				                       

						
<table width="100%" style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;">
			<tr>
				<td style="text-align:center; border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><a><b>Rang</b></a></td>  
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><a><b>Breasla</b></a></td>        
				<td style="text-align:center; border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><a><b>Regat</b></a></td>      
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><a><b>Nivel</b></a></td>          
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><a><b>Puncte</b></a></td>	
			</tr> 





<?php

$getID = replace($_GET['id']);
$db	= "player";		
mysql_select_db($db) OR
die();
function generatePages($max, $page, $class)
	{
		if ($max>=10)
		{
			if (($page>4) && ($page<$max-3))
			{
				for ($i = 1; $i <= 3; $i++)
				{
					$data .= showPage($i,$page,$class);
				}
				$data .= '<span class="'. $class .'">...</span> ';
				for ($i = $page-1; $i <= $page+1; $i++)
				{
					$data .= showPage($i,$page,$class);
				}
				$data .= '<span class="'. $class .'">...</span> ';
				for ($i = $max-2; $i <= $max; $i++)
				{
					$data .= showPage($i,$page,$class);
				}
			}
			else
			{
				for ($i = 1; $i <= 5; $i++)
				{
					$data .= showPage($i,$page,$class);
				}
				$data .= '<span class="'. $class .'">...</span> ';
				for ($i = $max-5+1; $i <= $max; $i++)
				{
					$data .= showPage($i,$page,$class);
				}
			}
		}
		else
		{
		$max = (10 >= $max) ? $max : 10;
		for ($i = 1; $i <= $max; $i++)
		{
				$data .= showPage($i,$page,$class);
		}
		}
		return $data;
	}
		
	/**
	 * Page Style Generator .
	 * 
	 * @param int $i
	 * @param int $page
	 * @param string $class
	 * @param string $selected
	 */
	function showPage($i, $page, $class, $selected = 'pagination_selected')
	{
		if ($page==$i)
		{
			$data .= '<span class="'. $selected .'">'. $i .'</span> ';
		}
		else
		{
			global $name;
			$getPage = replace($_GET['page']);
			$data .= '<span  class="'. $class .'"><a href="?page='.$getPage.'&id='.$i.'" onclick="load()">'. $i .'</a></span> ';
		}
		return $data;
	}
	
if ((!isset($getID)) || (!is_numeric($getID)) || ($getID < 1)) { $pagenum = 1; }
	else { $pagenum = $getID; 
	
	}
	$page_rows = 15;
	if (($pagenum > $last) && ($last > 0)) { $pagenum = $last; }
	$max = $pagenum * $page_rows;
	$min = $max - $page_rows;

	
	$result = mysql_query("SELECT * FROM guild WHERE guild.name NOT LIKE 'STAFF' ORDER BY ladder_point desc limit 0,100");
	

	$rows = mysql_num_rows($result);
	$last = ceil($rows/$page_rows);
$i = 0;
/////////////////////

$result2 = mysql_query("SELECT * FROM guild WHERE guild.name NOT LIKE 'STAFF' ORDER BY ladder_point desc limit ".($page_rows * ($pagenum - 1)).", ".$page_rows.""); 

//////////////////////////////////////////
if($getID == 1 || $getID == NULL)
{
	$nr=0;
}
else
{
	$nr = ((int)$getID-1)*(int)15+$nr;	
}
while($sGuild = mysql_fetch_object($result2))
{
	$nr++;				

	
	
	$leader = $sGuild->master;
	$reich = mysql_query("SELECT empire from player.player_index where pid1 = '$leader' OR pid2 = '$leader' OR pid3 = '$leader' OR pid4 = '$leader'");
	$reich2 = mysql_fetch_object($reich);
	$empire = $reich2->empire;	
	
	?>

			<tr>   
				<td style="text-align:center; border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><?=$nr?>
				</td>         
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><b><a><?=$sGuild->name?></a></b></td>                 
				<td style="text-align:center; border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><center><img src="resurse/imagini/regate/<?=$reich2->empire?>.png" width="34px" alt="regat" title="regat" /></center></td>        
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><b><?=$sGuild->level?></b></td>             
				<td style="border-color:#b79647; border-style:solid; padding:10px; border-width:1px;"><b><?=$sGuild->ladder_point?></b></td>       
			</tr> 



    <?php
} 
echo "</table><Br>";
echo "<div align='center'>";
	echo generatePages($last, $pagenum, "pagination");
	echo "</font></div>";
?>




		</div>           
</div>
<div class="postui post-end"></div>