-
Notifications
You must be signed in to change notification settings - Fork 11
/
Copy pathgetleaders.php
43 lines (36 loc) · 926 Bytes
/
getleaders.php
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
<?php
/*
* @copyright (c) 2008 Nicolo John Davis
* @license http://opensource.org/licenses/gpl-license.php GNU Public License
*/
session_start();
if(!isset($_SESSION['isloggedin']))
{
echo "<meta http-equiv='Refresh' content='0; URL=login.php' />";
exit(0);
}
else
{
$username = $_SESSION['username'];
$userid = $_SESSION['userid'];
}
include('settings.php');
$cn = mysql_connect('localhost', $DBUSER, $DBPASS);
mysql_select_db($DBNAME, $cn);
$query = "select * from scores";
$result = mysql_query($query);
print '<ul class="sidemenu">';
$i = 0;
while(($rows = mysql_fetch_array($result)) && $i<5)
{
//Print only normal users (not admins)
if($rows[rank] == 0)
{
print "<li style='position: relative'><span>$rows[username]</span><span style='position: absolute; right: 0px'>$rows[score]</span></li>";
$i++;
}
}
if($i == 0) print "<li></li>";
print "</ul>";
mysql_close($cn);
?>