• 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!

AAC Znote - Highscores

seyakuroya

DevlandOT.eu
Joined
Dec 21, 2008
Messages
711
Solutions
1
Reaction score
411
I'm using the latest:
-Znote AAC (github)
-OTX 3 (github)
And when i enter to highscores.php I see this:
*In PHPmyadmin all is fine, there are only 2 MADE CHARACTERS.
ZXMMMlf.png



My highscores.php

Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';

if ($config['log_ip']) {
    znote_visitor_insert_detailed_data(3);
}

// Fetch highscore type
$type = (isset($_GET['type'])) ? (int)getValue($_GET['type']) : 7;
if ($type > 9) $type = 7;

// Fetch highscore vocation
$configVocations = $config['vocations'];
//$debug['configVocations'] = $configVocations;

$vocationIds = array_keys($configVocations);

$vocation = 'all';
if (isset($_GET['vocation']) && is_numeric($_GET['vocation'])) {
    $vocation = (int)$_GET['vocation'];
    if (!in_array($vocation, $vocationIds)) {
        $vocation = "all";
    }
}

// Fetch highscore page
$page = getValue(@$_GET['page']);
if (!$page || $page == 0) $page = 1;
else $page = (int)$page;

$highscore = $config['highscore'];
$loadFlags = ($config['country_flags']['enabled'] && $config['country_flags']['highscores']) ? true : false;
$loadOutfits = ($config['show_outfits']['highscores']) ? true : false;

$rows = $highscore['rows'];
$rowsPerPage = $highscore['rowsPerPage'];

function skillName($type) {
    $types = array(
        1 => "Club",
        2 => "Sword",
        3 => "Axe",
        4 => "Distance",
        5 => "Shield",
        6 => "Fish",
        7 => "Experience", // Hardcoded
        8 => "Magic Level", // Hardcoded
        9 => "Fist", // Since 0 returns false I will make 9 = 0. :)
    );
    return $types[(int)$type];
}

function pageCheck($index, $page, $rowPerPage) {
    return ($index < ($page * $rowPerPage) && $index >= ($page * $rowPerPage) - $rowPerPage) ? true : false;
}

$cache = new Cache('engine/cache/highscores');
if ($cache->hasExpired()) {
    $vocGroups = fetchAllScores($rows, $config['TFSVersion'], $highscore['ignoreGroupId'], $configVocations, $vocation, $loadFlags, $loadOutfits);
    $cache->setContent($vocGroups);
    $cache->save();
} else {
    $vocGroups = $cache->load();
}

if ($vocGroups) {
    $vocGroup = (is_array($vocGroups[$vocation])) ? $vocGroups[$vocation] : $vocGroups[$vocGroups[$vocation]];
    ?>

    <h1>Ranking for <?php echo skillName($type) .", ". (($vocation === 'all') ? 'any vocation' : vocation_id_to_name($vocation)) ?>.</h1>
   
    <form action="" method="GET">

        <select name="type">
            <option value="7" <?php if ($type == 7) echo "selected"; ?>>Experience</option>
            <option value="8" <?php if ($type == 8) echo "selected"; ?>>Magic</option>
            <option value="5" <?php if ($type == 5) echo "selected"; ?>>Shield</option>
            <option value="2" <?php if ($type == 2) echo "selected"; ?>>Sword</option>
            <option value="1" <?php if ($type == 1) echo "selected"; ?>>Club</option>
            <option value="3" <?php if ($type == 3) echo "selected"; ?>>Axe</option>
            <option value="4" <?php if ($type == 4) echo "selected"; ?>>Distance</option>
            <option value="6" <?php if ($type == 6) echo "selected"; ?>>Fish</option>
            <option value="9" <?php if ($type == 9) echo "selected"; ?>>Fist</option>
        </select>

        <select name="vocation">
            <option value="all" <?php if (!is_int($vocation)) echo "selected"; ?>>Any vocation</option>
            <?php
            foreach ($configVocations as $v_id => $v_data) {
                if ($v_data['fromVoc'] === false) {
                    $selected = (is_int($vocation) && $vocation == $v_id) ? " selected $vocation = $v_id" : "";
                    echo '<option value="'. $v_id .'"'. $selected .'>'. $v_data['name'] .'</option>';
                }
            }
            ?>
        </select>

        <select name="page">
            <?php
            $pages = ceil(min(($highscore['rows'] / $highscore['rowsPerPage']), (count($vocGroup[$type]) / $highscore['rowsPerPage'])));
            for ($i = 0; $i < $pages; $i++) {
                $x = $i + 1;
                if ($x == $page) echo "<option value='".$x."' selected>Page: ".$x."</option>";
                else echo "<option value='".$x."'>Page: ".$x."</option>";
            }
            ?>
        </select>

        <input type="submit" value=" View " class="btn btn-info">
    </form>

    <table id="highscoresTable" class="table table-striped table-hover">

        <tr class="yellow">
            <?php if ($loadOutfits) echo "<td>Outfit</td>"; ?>
            <td>Rank</td>
            <td>Name</td>
            <td>Vocation</td>
            <td>Level</td>
            <?php if ($type === 7) echo "<td>Points</td>"; ?>
        </tr>

        <?php
        for ($i = 0; $i < count($vocGroup[$type]); $i++) {

            if ($vocGroup[$type] === false) {
                ?>
                <tr>
                    <td colspan="5">Nothing to show here yet.</td>
                </tr>
                <?php
            } else {
                if (pageCheck($i, $page, $rowsPerPage)) {
                    $flag = ($loadFlags === true && strlen($vocGroup[$type][$i]['flag']) > 1) ? '<img src="' . $config['country_flags']['server'] . '/' . $vocGroup[$type][$i]['flag'] . '.png">  ' : '';
                    ?>
                    <tr>
                        <?php if ($loadOutfits): ?>
                            <td class="outfitColumn"><img src="<?php echo $config['show_outfits']['imageServer']; ?>?id=<?php echo $vocGroup[$type][$i]['type']; ?>&addons=<?php echo $vocGroup[$type][$i]['addons']; ?>&head=<?php echo $vocGroup[$type][$i]['head']; ?>&body=<?php echo $vocGroup[$type][$i]['body']; ?>&legs=<?php echo $vocGroup[$type][$i]['legs']; ?>&feet=<?php echo $vocGroup[$type][$i]['feet']; ?>" alt="img"></td>
                        <?php endif; ?>
                        <td><?php echo $i+1; ?></td>
                        <td><?php echo $flag; ?><a href="characterprofile.php?name=<?php echo $vocGroup[$type][$i]['name']; ?>"><?php echo $vocGroup[$type][$i]['name']; ?></a></td>
                        <td><?php echo vocation_id_to_name($vocGroup[$type][$i]['vocation']); ?></td>
                        <td><?php echo $vocGroup[$type][$i]['value']; ?></td>
                        <?php if ($type === 7) echo "<td>". $vocGroup[$type][$i]['experience'] ."</td>"; ?>
                    </tr>
                    <?php
                }
            }

        }
        ?>
    </table>
    <?php
}
include 'layout/overall/footer.php'; ?>
 
Do you have duplicate entries (two entries with same player_id) in znote_players table?

Login as admin, it should turn on SQL query logging. Now when you visit the highscore page, scroll to bottom of site and post the queries so I can have a look at them.
 
Do you have duplicate entries (two entries with same player_id) in znote_players table?

Login as admin, it should turn on SQL query logging. Now when you visit the highscore page, scroll to bottom of site and post the queries so I can have a look at them.

znote_players table is fine Now I was deleted all players from there and still have the same problem :(

Code:
Logged in as Admin: SQL queries executed:
Print: - Array
(
    [0] => [0.0009] SELECT `id`, `name`, `password`, `email`, `premdays` FROM `accounts` WHERE `id` = 2 LIMIT 1;
    [1] => [0.001] SELECT `ip`, `created`, `points`, `cooldown`, `flag` FROM `znote_accounts` WHERE `account_id` = 2 LIMIT 1;
    [2] => [0.0012] SELECT `id`, `player_id` FROM `znote_forum_threads` WHERE `forum_id`='4' AND `closed`='0';
    [3] => [0.0014] SELECT `name`, `level`, `experience` FROM `players` WHERE `group_id` < 2 ORDER BY `experience` DESC LIMIT 5;
    [4] => [0.0016] SELECT COUNT(`player_id`) AS `value` FROM `players_online`;
    [5] => [0.0017] SELECT COUNT(`id`) AS `id` from `accounts`;
    [6] => [0.0019] SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_club` AS `value`, `za`.`flag` , `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons` FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < 2  ORDER BY `p`.`skill_club` DESC LIMIT 0, 100;
    [7] => [0.002] SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_sword` AS `value`, `za`.`flag` , `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons` FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < 2  ORDER BY `p`.`skill_sword` DESC LIMIT 0, 100;
[...] TO LONG code
      [48] => [0.0059] SELECT `p`.`name`, `p`.`vocation`, `p`.`experience`, `level` AS `value`, `za`.`flag` , `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons` FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < 2 AND `p`.`vocation` IN (3, 7) ORDER BY `p`.`experience` DESC LIMIT 0, 100;
    [49] => [0.006] SELECT `p`.`name`, `p`.`vocation`, `p`.`maglevel` AS `value`, `za`.`flag` , `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, IN (4, 8) ORDER BY `p`.`maglevel` DESC LIMIT 0, 100;
    [59] => [0.0069] SELECT `p`.`name`, `p`.`vocation`, `p`.`skill_fist` AS `value`, `za`.`flag` , `p`.`lookbody` AS `body`, `p`.`lookfeet` AS `feet`, `p`.`lookhead` AS `head`, `p`.`looklegs` AS `legs`, `p`.`looktype` AS `type`, `p`.`lookaddons` AS `addons` FROM `players` AS `p` INNER JOIN `znote_accounts` AS `za` ON `p`.`account_id`=`za`.`account_id` WHERE `p`.`group_id` < 2 AND `p`.`vocation` IN (4, 8) ORDER BY `p`.`skill_fist` DESC LIMIT 0, 100;
)
 
I wiped all account from previous server and now every new player shown on highscores/who is online is doubled with parameters of prevoius player with same id (flags).


EDIT: disabling outfit/flags repaired the problem
 
Last edited:
I have the same problem, there is no error in website, but the flag icon is not appearing in online list or character profile. Downloaded flags from znote and placed the folder inside www
tried this
PHP:
'server' => '127.0.0.1/flags'
'server' => '/flags'
'server' => 'flags'

also my config.php
    // Use country flags
    $config['country_flags'] = array(
        'enabled' => true,
        'highscores' => true,
        'onlinelist' => true,
        'characterprofile' => true,
        // 'server' => 'http://127.0.0.1/flags'
        'server' => '127.0.0.1/flags'
    );
 
Back
Top