mirror of
https://github.com/Znote/ZnoteAAC.git
synced 2025-05-02 20:29:21 +02:00
Create powergamers.php
Please tell me if there are any mistakes or how to improve it. I am quite beginner with SQL, not even 100% sure if it works as it should. So, if you see anything wrong with it please let me know :)
This commit is contained in:
parent
ab1816bb84
commit
e62e35f5c3
70
powergamers.php
Normal file
70
powergamers.php
Normal file
@ -0,0 +1,70 @@
|
||||
<?php
|
||||
require_once 'engine/init.php';
|
||||
include 'layout/overall/header.php';
|
||||
$powergamers = $config['powergamers'];
|
||||
$limit = $powergamers['limit'];
|
||||
|
||||
if ($config['powergamers_enabled'] === false) {
|
||||
echo 'Powergamers page has been disabled at config.php.';
|
||||
include 'layout/overall/footer.php';
|
||||
exit();
|
||||
}
|
||||
?>
|
||||
<style>
|
||||
#selectedP {
|
||||
text-decoration: underline
|
||||
}
|
||||
</style>
|
||||
<?php
|
||||
$type = $_GET['type'];
|
||||
|
||||
function coloured_value($valuein)
|
||||
{
|
||||
$value2 = $valuein;
|
||||
while(strlen($value2) > 3)
|
||||
{
|
||||
$value .= '.'.substr($value2, -3, 3);
|
||||
$value2 = substr($value2, 0, strlen($value2)-3);
|
||||
}
|
||||
@$value = $value2.$value;
|
||||
if($valuein > 0)
|
||||
return '<b><font color="green">+'.$value.'</font></b>';
|
||||
elseif($valuein < 0)
|
||||
return '<font color="red">'.$value.'</font>';
|
||||
else
|
||||
return $value;
|
||||
}
|
||||
|
||||
if(empty($type))
|
||||
$znotePlayers = mysql_select_multi('SELECT * FROM `players` JOIN `znote_players` ON `players`.`id` = `znote_players`.`id` WHERE `group_id` < 2 ORDER BY `exphist_lastexp` DESC LIMIT ' . $limit);
|
||||
elseif($type >= 1 && $type <= 3)
|
||||
$znotePlayers = mysql_select_multi('SELECT * FROM `znote_players` JOIN `players` ON `znote_players`.`id` = `players`.`id` WHERE `group_id` < 2 ORDER BY `exphist' . (int) $type . '` DESC LIMIT '.$limit);
|
||||
echo '<CENTER><H2>Ranking of powergamers</H2></CENTER>
|
||||
<BR>
|
||||
<table class="table table-striped">
|
||||
<td><center><b>#</b></center></td>
|
||||
<td><b>Name</b></td>';
|
||||
echo '<td><center>Total</center></td>';
|
||||
|
||||
for($i = 3; $i >= 2; $i--)
|
||||
echo ($type == $i) ? '<TD id="selectedP" width="12%"><a href="powergamers.php?type='.$i.'">'.$i.'<b> Days Ago</b></a></B></TD>' : '<TD width="12%"><center><a href="powergamers.php?type='.$i.'">'.$i.' Days Ago</a></TD>';
|
||||
echo ($type == 1) ? '<TD id="selectedP" width="12%"><b><a href="powergamers.php?type=1">1 Day Ago</a></B></TD>' : '<TD width="12%"><a href="powergamers.php?type=1">1 Day Ago</a></TD>';
|
||||
echo (empty($type)) ? '<TD id="selectedP"><b><a href="powergamers.php">Today</a></b></TD>' : '<TD><a href="powergamers.php">Today</a></TD>';
|
||||
echo '</TR>';
|
||||
|
||||
$number_of_rows = 1;
|
||||
if($znotePlayers)
|
||||
foreach($znotePlayers as $player)
|
||||
{
|
||||
echo '<td><center>'. $number_of_rows . '.</center></td>';
|
||||
echo '<td><b>' .$player['name']. '</b>';
|
||||
echo '<br> ' .$player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])).' ';
|
||||
echo '<td><center>'.coloured_value($player['exphist1'] + $player['exphist2'] + $player['exphist3']).'</center></td>';
|
||||
echo '<td><center>'.coloured_value($player['exphist3']).'</center></td><td><center>'.coloured_value($player['exphist2']).'</center></td><td><center>'.coloured_value($player['exphist1']).'</center></td><td><center>'.coloured_value($player['exphist_lastexp']).'</center></td></tr>';
|
||||
$number_of_rows++;
|
||||
}
|
||||
echo '</table><br></div>';
|
||||
?>
|
||||
<?php
|
||||
include 'layout/overall/footer.php';
|
||||
?>
|
Loading…
x
Reference in New Issue
Block a user