<?php
session_start();
include ('private/mysql.php');
include ('tmp/head.php');




switch($sd){
default:

echo "Топ 5 самых активных:<br>";
$q = mysql_query("SELECT * FROM `users` WHERE `id`!='7' and `id`!='1' and `np`!='ok' ORDER BY `allonline` DESC LIMIT 5");

While($w = mysql_fetch_assoc($q)){
    $i++;
    echo "$i.<a href='user.php?id=$w[id]'>$w[login]</a> (".time_left($w['allonline']).")<br>";
}


echo "<br><br>
<a href='?sd=level'>Самые опытные</a><br>
<a href='?sd=uron'>Самые сильные</a><br>
<a href='?sd=exporden'>Рейтинг Орденов</a><br><br>";

$q = mysql_query("SELECT * FROM `users` WHERE `access`='3'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=lightgreen>Администратор</font><br>";
}
$q = mysql_query("SELECT * FROM `users` WHERE `access`='2'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=#3366FF>Модератор</font><br>";
}

break;



case 'exporden':
echo "Топ 5 орденов по уровню:<br>";
$q = mysql_query("SELECT * FROM `orden` WHERE `exp`>='1' ORDER BY `level` DESC, `exp` DESC LIMIT 5");

While($w = mysql_fetch_assoc($q)){
    
    $lid = mysql_fetch_assoc(mysql_query("SELECT * FROM `users` WHERE `id`='$w[lider]'"));
    
    echo "<a href='/info/orden/$w[id]'>$w[name]</a> [Лидер: <a href='/userid$lid[id]'>$lid[login]</a>] <small>($w[level] lvl | ".number_format($w['exp'])." exp)</small><br>";
    
}

echo "<br><br>
<a href='rating.php'>Самые активные</a><br>
<a href='?sd=exp'>Самые опытные</a><br>
<a href='?sd=uron'>Самые сильные</a><br><br>";

$q = mysql_query("SELECT * FROM `users` WHERE `access`='3'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=lightgreen>Администратор</font><br>";
}
$q = mysql_query("SELECT * FROM `users` WHERE `access`='2'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=#3366FF>Модератор</font><br>";
}

break;



case 'level':
echo "Топ 5 самых опытных:<br>";
$q = mysql_query("SELECT * FROM `users` WHERE `id`!='7' and `id`!='1' and `np`!='ok' ORDER BY `level` DESC LIMIT 5");

While($w = mysql_fetch_assoc($q)){
    $i++;
    echo "$i.<a href='user.php?id=$w[id]'>$w[login]</a> ($w[level] ур.)<br>";
}

echo "<br><br>
<a href='rating.php'>Самые активные</a><br>
<a href='?sd=uron'>Самые сильные</a><br><br>";

$q = mysql_query("SELECT * FROM `users` WHERE `access`='3'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=lightgreen>Администратор</font><br>";
}
$q = mysql_query("SELECT * FROM `users` WHERE `access`='2'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=#3366FF>Модератор</font><br>";
}

break;


case 'uron':

echo "Топ 5 самых сильных:<br>";
$q = mysql_query("SELECT * FROM `users` WHERE `id`!='7' and `id`!='1' and `np`!='ok' ORDER BY `max_u` DESC LIMIT 5");

While($w = mysql_fetch_assoc($q)){
    $i++;
    echo "$i.<a href='user.php?id=$w[id]'>$w[login]</a>  (<img src='img/uron.png'>$w[min_u] - $w[max_u])<br>";
}





echo "<br><br>
<a href='rating.php'>Самые активные</a><br>
<a href='?sd=exp'>Самые опытные</a><br><br>";

$q = mysql_query("SELECT * FROM `users` WHERE `access`='3'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=lightgreen>Администратор</font><br>";
}
$q = mysql_query("SELECT * FROM `users` WHERE `access`='2'");
While($w = mysql_fetch_assoc($q)){
    echo "<a href='user.php?id=$w[id]'>$w[login]</a> - <font color=#3366FF>Модератор</font><br>";
}

break;


}
include ('tmp/foot.php');
?>