<?php
/*
Fretsweb - A Frets on Fire chart server
Copyright (C) 2009 Daan Sprenkels
This program is free software: you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
You should have received a copy of the GNU General Public License
along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
// Include the common file
require_once "admin/common.php";
// Send headers for content-type
header('Content-Type: text/html; charset=utf-8');
// Include language
require_once "lang/$language.php";
// Write header
print_header($lang['players']);
// Declare the compare function, we will need it later
function cmp($a, $b)
{
return strcmp(strtolower($a), strtolower($b));
}
// Shwo the players
echo "<table class=\"regular\"><tr>";
foreach(array('Amazing','Medium','Easy','Supaeasy') as $dif)
{
echo "<td>";
$sql = "SELECT `name` FROM `contest_players` WHERE `$dif`='1'";
$query = mysql_query($sql);
if(@mysql_num_rows($query) > 0)
{
$rows = array();
while($row = mysql_fetch_assoc($query))
{
$rows[count($rows)] = $row['name'];
}
usort($rows, "cmp");
echo "<h3>{$lang[$dif]}</h3>";
echo "<table>";
$i = 1;
foreach($rows as $name)
{
echo "<tr>";
echo "<td class=\"amiddle\">$i</td>";
echo "<td class=\"amiddle\"><a href=\"player.php?name=$name\">$name</a></td>";
echo "</tr>";
$i++;
}
echo "</table>";
}
else
{
echo sprintf("<p>{$lang['no_players_on']}</p>" , $dif);
}
echo "</td>";
// We are done, let's delete everything
@mysql_free_result($query);
unset($sql, $query, $rows, $row, $name);
}
echo "</tr></table>";
// Write a hyperlink to join.php if allowed
if($allowjoinrequests)
{
echo "<p><a href=\"join.php\">{$lang['click_here_join']}</a></p>";
}
// Write footer
echo "</div>";
include "admin/pagefooter.php";
echo "
</div>
</body>
</html>";
// Close database link
mysql_close( $db_link );
?>