<?php

$title ='Топ 10 игроков';
$load=array('user');
include_once 'protected/sys.php';

$topers = $db->fetchAll("SELECT `id`,`login`,`str`,`def`,`max_hp`,`sex`,
						 (`users`.`str`+`users`.`def`+.`users`.`max_hp`) as `stats` 
						 FROM `users`
						 ORDER BY `stats`
						 DESC LIMIT 10",NULL);

$topCount =  0;
echo '<div class="menu">';
if (is_array($topers))
{
	foreach ($topers as $data) 
	{
		$topCount++;

		echo '<a class="menu" href =\'/user?id='.$data['id'].'\'/>';

		if ($topCount == 1)
		{
			echo '<img src =\'/imgData/static/best.png\'/>';
		}
		echo '<img src=\'/imgData/static/'.($data['sex'] == 1? 1:0).'.png\'/>';
		$us=new user($db);
		$login=$us->login($data['id']);
		echo $login; 
		echo '<span style =\'float:right;\'/>
				<img src =\'/imgData/static/str.png\'/>
				<img src =\'/imgData/static/hp.png\'/>
				<img src =\'/imgData/static/def.png\'/>
			 '.$data['stats'].'</span>';
		echo '</a></li>';
	}
}
echo "</div>";

include_once $config['root'].'/protected/footermain.php';