include('../config.php');
function show_nick($user) {
$r = '';
if($user['align'] != 0) {
$r .= ' ';
}
if($user['klan'] != '') {
$r .= ' ';
}
$r .= ''.$user['login'].' ['.$user['level'].'] ';
return $r;
}
function ClanImage($clan_id) {
$clanimg = mysql_fetch_assoc(mysql_query("SELECT `short` FROM `clans` WHERE `id` = '{$clan_id}' LIMIT 1"));
if($clanimg['short']) {
$clanimg = $clanimg['short'];
} else {
$clanimg = "1x1";
}
return $clanimg;
}
function form($type) {
$i = 1; $r = ''; $rs = '';
$tps = array('exp' => 'Опыта', 'win' => 'Побед', 'lose' => 'Поражений', 'nich' => 'Ничьих');
$r .= '
| | |
';
$r .= ' | Персонаж | '.$tps[$type].' |
';
$data = mysql_query('SELECT `id`, `login`, `level`, `align`, `klan`, `exp`, `win`, `lose`, `nich`, `bot`, `block` FROM `users` WHERE `bot` = 0 AND `align` != 2.99 AND `block` = 0 AND `email` != "admin@old-dark.ru" ORDER BY `'.$type.'` DESC LIMIT 100');
while($row = mysql_fetch_array($data)) {
if($type == 'exp') { $rs = $row['exp']; }
if($type == 'win') { $rs = $row['win']; }
if($type == 'lose') { $rs = $row['lose']; }
if($type == 'nich') { $rs = $row['nich']; }
$r .= '';
$r .= ''.$i.' | ';
$r .= ''.show_nick($row).' | ';
$r .= ''.$rs.' | ';
$r .= '
';
$i++;
}
$r .= '
';
$r .= '';
return $r;
}
if($_POST['type']) {
if($_POST['type'] == 'exp') {
echo form('exp');
} elseif($_POST['type'] == 'win') {
echo form('win');
} elseif($_POST['type'] == 'lose') {
echo form('lose');
} elseif($_POST['type'] == 'nich') {
echo form('nich');
} else {
echo 'Потерян параметр сортировки ...';
}
}
?>