• There is NO official Otland's Discord server and NO official Otland's server list. The Otland's Staff does not manage any Discord server or server list. Moderators or administrator of any Discord server or server lists have NO connection to the Otland's Staff. Do not get scammed!

TFS 1.X+ [PHP] - Powergamers

MvJ

New Member
Joined
May 20, 2018
Messages
17
Best answers
0
Reaction score
2
Hello!

Okey so I added powergamers.php to znoteacc and it works great. The only problem is that i don't want it to show 20 rows of players. The powergamers.php file tries to check config.php for the row limit option.

Code:
$limit = $config['powergamers']['limit'];
However my config.php did not originally have this option in my znoteacc version.
So i tried adding it in config.php to see if it would do anything. It did not..

So now im wondering if anyone out there knows how to change the powergamers.php itself to only display 5 rows. Instead of trying to go into config.php to check.

here is the code

Code:
<?php
require_once 'engine/init.php';
include 'layout/overall/header.php'; 
if (!$config['powergamers']['enabled']) {
echo 'This page has been disabled at config.php.';
include 'layout/overall/footer.php';
    exit();
}
?>
<div class="panel">
<div class="page-header"><h3>Powergamers</h3></div>
    <?php
    $limit = $config['powergamers']['limit'];
    $days = isset($_POST['days']);
    $today = true;
    if ($days) {
        $selected = ($_POST['days']);
        $days = $selected[1];
        $vocation = $selected[0];
        if ($days > 0)
        $today = false;
    } else {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);
    }
    $limit = $config['powergamers']['limit'];

    if(!empty($days) && !empty($vocation)) 
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    elseif(empty($days) && !empty($vocation)) {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `expdiff` DESC LIMIT '.$limit);
    }elseif(!empty($days) && empty($vocation)) 
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    else 
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);

    $showVoc = (!empty($vocation)) ? $vocation : 0;
    ?>
    <form class="form form-inline" action="" method="post">
        <div class="col sm-4">
            <center>
            <select class="form-control" name="days[]">
                <option value="" selected="all">All</option>
                <option value="1">Sorcerers</option>
                <option value="2">Druids</option>
                <option value="3">Paladins</option>
                <option value="4">Knights</option>
                <option value="none">No vocation</option>
            </select>
            <select class="form-control" name="days[]">
                <option value="" selected="Today">Today</option>
                <option value="1">Yesterday</option>
                <option value="2">2 days ago</option>
                <option value="3">3 days ago</option>
            </select>
            <input type="submit" class="btn btn-primary"><br>
            <?php echo ($showVoc > 0) ? 'Showing only <b>'. strtolower(vocation_id_to_name($vocation)).'s</b> and' : 'Showing <b>all</b> vocations and'; ?>
            <?php echo ($days > 0) ? 'sorted by <b>'. $days .'</b> days': 'sorted by <b>today</b>';     ?>.
            </center>
        </div>
    </form>
    <table class="table table-striped">
        <td width="5%"><center>#</center></td>
        <td>Name</td>
        <?php
    for($i = 3; $i >= 2; $i--)
        echo ($days == $i) ? '<td class="pull-right" width="70%"><b>'.$i.' Days Ago</b></td>' : '';
        echo ($days == 1) ? '<td class="pull-right" width="70%"><b>Yesterday</b></td>' : '';
        echo ($today) ? '<td class="pull-right" width="70%"><b>Today</b></td>' : '';
        echo ($days == 4) ? '<td class="pull-right" width="70%"><b>Total</b></td>' : '';
        echo '</tr>';

    $number_of_rows = 0;
    if($znotePlayers) {
        foreach($znotePlayers as $player)
        {
            $number_of_rows++;
            echo '<td><center>'. $number_of_rows . '.</center></td>';
            echo '<td><a href="characterprofile.php?name=' .$player['name']. '">' .$player['name']. '</a>';
            echo '<br> '. ($player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])) ).' ';
            echo ($days == 3) ? '<td><center>'. number_format($player['exphist3']) .'</center></td>' : '';
            echo ($days == 2) ? '<td><center>'. $player['exphist2'] .'</center></td>' : '';
            echo ($days == 1) ? '<td><center>'. $player['exphist1'] .'</center></td>' : '';
            echo ($today == true) ? '<td><center>'. ($player['experience']-$player['exphist_lastexp']) .'</center></td>' : '';
            echo '</tr>';
        }
    }
    ?>
    </table>
    <br>
</div>
<?php
include 'layout/overall/footer.php';
 

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,557
Best answers
8
Reaction score
897
Location
Spain
PHP:
<?php
require_once 'engine/init.php';
include 'layout/overall/header.php';
if (!$config['powergamers']['enabled']) {
echo 'This page has been disabled at config.php.';
include 'layout/overall/footer.php';
    exit();
}
?>
<div class="panel">
<div class="page-header"><h3>Powergamers</h3></div>
    <?php
    $limit = 5;
    $days = isset($_POST['days']);
    $today = true;
    if ($days) {
        $selected = ($_POST['days']);
        $days = $selected[1];
        $vocation = $selected[0];
        if ($days > 0)
        $today = false;
    } else {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);
    }
    $limit = $config['powergamers']['limit'];
    if(!empty($days) && !empty($vocation))
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    elseif(empty($days) && !empty($vocation)) {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `expdiff` DESC LIMIT '.$limit);
    }elseif(!empty($days) && empty($vocation))
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    else
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);
    $showVoc = (!empty($vocation)) ? $vocation : 0;
    ?>
    <form class="form form-inline" action="" method="post">
        <div class="col sm-4">
            <center>
            <select class="form-control" name="days[]">
                <option value="" selected="all">All</option>
                <option value="1">Sorcerers</option>
                <option value="2">Druids</option>
                <option value="3">Paladins</option>
                <option value="4">Knights</option>
                <option value="none">No vocation</option>
            </select>
            <select class="form-control" name="days[]">
                <option value="" selected="Today">Today</option>
                <option value="1">Yesterday</option>
                <option value="2">2 days ago</option>
                <option value="3">3 days ago</option>
            </select>
            <input type="submit" class="btn btn-primary"><br>
            <?php echo ($showVoc > 0) ? 'Showing only <b>'. strtolower(vocation_id_to_name($vocation)).'s</b> and' : 'Showing <b>all</b> vocations and'; ?>
            <?php echo ($days > 0) ? 'sorted by <b>'. $days .'</b> days': 'sorted by <b>today</b>';     ?>.
            </center>
        </div>
    </form>
    <table class="table table-striped">
        <td width="5%"><center>#</center></td>
        <td>Name</td>
        <?php
    for($i = 3; $i >= 2; $i--)
        echo ($days == $i) ? '<td class="pull-right" width="70%"><b>'.$i.' Days Ago</b></td>' : '';
        echo ($days == 1) ? '<td class="pull-right" width="70%"><b>Yesterday</b></td>' : '';
        echo ($today) ? '<td class="pull-right" width="70%"><b>Today</b></td>' : '';
        echo ($days == 4) ? '<td class="pull-right" width="70%"><b>Total</b></td>' : '';
        echo '</tr>';
    $number_of_rows = 0;
    if($znotePlayers) {
        foreach($znotePlayers as $player)
        {
            $number_of_rows++;
            echo '<td><center>'. $number_of_rows . '.</center></td>';
            echo '<td><a href="characterprofile.php?name=' .$player['name']. '">' .$player['name']. '</a>';
            echo '<br> '. ($player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])) ).' ';
            echo ($days == 3) ? '<td><center>'. number_format($player['exphist3']) .'</center></td>' : '';
            echo ($days == 2) ? '<td><center>'. $player['exphist2'] .'</center></td>' : '';
            echo ($days == 1) ? '<td><center>'. $player['exphist1'] .'</center></td>' : '';
            echo ($today == true) ? '<td><center>'. ($player['experience']-$player['exphist_lastexp']) .'</center></td>' : '';
            echo '</tr>';
        }
    }
    ?>
    </table>
    <br>
</div>
<?php
include 'layout/overall/footer.php';
 
OP
MvJ

MvJ

New Member
Joined
May 20, 2018
Messages
17
Best answers
0
Reaction score
2
Thanks for the reply!
It didn't work. Is there a chance i have to wait for it to update list again until it put correct rows? Or should it just do it right away? :)
 

Raggaer

Godly Member
Joined
Jul 25, 2012
Messages
1,557
Best answers
8
Reaction score
897
Location
Spain
PHP:
<?php
require_once 'engine/init.php';
include 'layout/overall/header.php';
if (!$config['powergamers']['enabled']) {
echo 'This page has been disabled at config.php.';
include 'layout/overall/footer.php';
    exit();
}
?>
<div class="panel">
<div class="page-header"><h3>Powergamers</h3></div>
    <?php
    $limit = 5;
    $days = isset($_POST['days']);
    $today = true;
    if ($days) {
        $selected = ($_POST['days']);
        $days = $selected[1];
        $vocation = $selected[0];
        if ($days > 0)
        $today = false;
    } else {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);
    }
    $limit = 5;
    if(!empty($days) && !empty($vocation))
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    elseif(empty($days) && !empty($vocation)) {
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 AND `a`.`vocation`='. (int)$vocation .' OR `a`.`vocation`='. ((int)$vocation +4) .' ORDER BY `expdiff` DESC LIMIT '.$limit);
    }elseif(!empty($days) && empty($vocation))
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`, (`a`.`experience` - `b`.`exphist_lastexp`) AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `exphist' . (int)$days . '` DESC LIMIT '.$limit);
    else
        $znotePlayers = mysql_select_multi('SELECT `a`.`id`, `b`.`player_id`, `a`.`name`, `a`.`vocation`, `a`.`level`, `a`.`group_id`, `a`.`experience`, `b`.`exphist_lastexp`, `b`.`exphist1`, `b`.`exphist2`, `b`.`exphist3`, `b`.`exphist4`, `b`.`exphist5`, `b`.`exphist6`, `b`.`exphist7`,   (`a`.`experience` - `b`.`exphist_lastexp`)  AS `expdiff` FROM `players` `a` JOIN `znote_players` `b` ON `a`.`id` = `b`.`player_id`  WHERE `a`.`group_id` < 2 ORDER BY `expdiff` DESC LIMIT '.$limit);
    $showVoc = (!empty($vocation)) ? $vocation : 0;
    ?>
    <form class="form form-inline" action="" method="post">
        <div class="col sm-4">
            <center>
            <select class="form-control" name="days[]">
                <option value="" selected="all">All</option>
                <option value="1">Sorcerers</option>
                <option value="2">Druids</option>
                <option value="3">Paladins</option>
                <option value="4">Knights</option>
                <option value="none">No vocation</option>
            </select>
            <select class="form-control" name="days[]">
                <option value="" selected="Today">Today</option>
                <option value="1">Yesterday</option>
                <option value="2">2 days ago</option>
                <option value="3">3 days ago</option>
            </select>
            <input type="submit" class="btn btn-primary"><br>
            <?php echo ($showVoc > 0) ? 'Showing only <b>'. strtolower(vocation_id_to_name($vocation)).'s</b> and' : 'Showing <b>all</b> vocations and'; ?>
            <?php echo ($days > 0) ? 'sorted by <b>'. $days .'</b> days': 'sorted by <b>today</b>';     ?>.
            </center>
        </div>
    </form>
    <table class="table table-striped">
        <td width="5%"><center>#</center></td>
        <td>Name</td>
        <?php
    for($i = 3; $i >= 2; $i--)
        echo ($days == $i) ? '<td class="pull-right" width="70%"><b>'.$i.' Days Ago</b></td>' : '';
        echo ($days == 1) ? '<td class="pull-right" width="70%"><b>Yesterday</b></td>' : '';
        echo ($today) ? '<td class="pull-right" width="70%"><b>Today</b></td>' : '';
        echo ($days == 4) ? '<td class="pull-right" width="70%"><b>Total</b></td>' : '';
        echo '</tr>';
    $number_of_rows = 0;
    if($znotePlayers) {
        foreach($znotePlayers as $player)
        {
            $number_of_rows++;
            echo '<td><center>'. $number_of_rows . '.</center></td>';
            echo '<td><a href="characterprofile.php?name=' .$player['name']. '">' .$player['name']. '</a>';
            echo '<br> '. ($player['level']. ' '.htmlspecialchars(vocation_id_to_name($player['vocation'])) ).' ';
            echo ($days == 3) ? '<td><center>'. number_format($player['exphist3']) .'</center></td>' : '';
            echo ($days == 2) ? '<td><center>'. $player['exphist2'] .'</center></td>' : '';
            echo ($days == 1) ? '<td><center>'. $player['exphist1'] .'</center></td>' : '';
            echo ($today == true) ? '<td><center>'. ($player['experience']-$player['exphist_lastexp']) .'</center></td>' : '';
            echo '</tr>';
        }
    }
    ?>
    </table>
    <br>
</div>
<?php
include 'layout/overall/footer.php';
 
  • Like
Reactions: MvJ
OP
MvJ

MvJ

New Member
Joined
May 20, 2018
Messages
17
Best answers
0
Reaction score
2
Thanks so much Raggaer! Amazing! =)
 
Top