<?
require_once LOCALE.LOCALESET."search.php";
echo "<title>".$locale['search000']." | ".$settings['sitename']."</title>";
echo "</head>";
echo"<script type='text/javascript' src='".JS."jquery.js'></script>\n";
echo"<script type='text/javascript' src='".JS."cookies.js'></script>\n";
echo"<script type='text/javascript' src='".JS."jquery.cookies.js'></script>\n";
require_once INCLUDES."navigation.php";
 if(!isset ($_POST['map']) && !isset ($_POST['null'])) 

{
?>
<center>
<h2><?=$locale['search001']?></h2>

<form action="search" method="POST" id="form1">
	<table cellpadding="5" cellspacing="0">
		<tr>
			<td valign="top"><?=$locale['search002']?></td>

			<td><input type="text" name="map" id="map" value="" size="50" /><br /><small><?=$locale['search003']?><a href="#" onclick="document.getElementById('map').value='de_dust,de_dust2,de_inferno'; return(false);"><?=$locale['search004']?></small></td>
		</tr>
		<?
		?>
		<tr>
			<td></td>
			<td><input type="submit" value="Найти" class='button' /></td>
		</tr>
	</table>
</form>
</div>
</center>
<?
}
else{
if ($_POST['map']=='') 
{
$search=servers('all');}
else{
$search = dbquery("SELECT * FROM amx_servers WHERE MATCH (server_map) AGAINST ('".$_POST['map']."') and server_status=1"); 
}
echo"<center><table border='0'  align='center' cellpadding='0' cellspacing='0' class='stat sortable' id='myleaderboard'>";

echo "<th>#</th><th width=350><center>".$locale['010']."</center></th><th width=150><center>".$locale['011']."</center></th><th width=100><center>".$locale['012']."</center></th><th width=70><center>".$locale['013']."</center></th><th width=70><center>".$locale['014']."</center></th><th><center>".$locale['015']."</center></th><th width=70><center>".$locale['016']."</center></th></tr>";
$i=0;
while($r=dbarray_fetch($search)) {
$players = $r['server_players']."/".$r['server_maxplayers'] ;
if($r['server_players'] == $r['server_maxplayers'])
{ $players = "<font color='#00FF00'>".$r['server_players']."/".$r['server_maxplayers']."</font>";}
if($r['server_players'] == 0)
{ $players = "<font color='red'>".$r['server_players']."/".$r['server_maxplayers']."</font>";}
$i++;
echo"<tr><td>$i</td>";
echo"<td align='left'><a href='server-$r[server_id]' id='link'>$r[server_name]</a></td>";
echo"<td align='center'>$r[server_ip]</td>";
echo"<td align='center'>$r[server_map]</td>";
echo"<td align='center'>".$players."</td>";
echo"<td align='center'>$r[server_protokol]</td>";
echo"<td align='center'><img src='images/flags/$r[server_location].png' height='12' width='16' alt='$r[server_location]' title='$r[server_location]''></td>";
echo"<td align='center'>";
if($r['server_vip']==1){ echo $locale['018']; }
	else{
echo "<span class='votes_count' id='votes_count$r[server_id]' >".$r['votes']."</span>";
echo "<span class='vote_buttons' id='vote_buttons$r[server_id]'>";
echo "	<a href='javascript:;' class='vote' id='$r[server_id]'></a>";
echo "</span>";
		}
echo "</td></tr></tr>";
	}

echo"</tbody></table>";
	echo"<hr class='clear'>";
}