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

[ZNOTE AAC] Flags for characterview and highscores

Have you even tested it on 1.0?
Try it and post the errors insted, no one is gonna look through the code to posibly find an error of a code lenght over 50 lines.
 
Okay look

the first step works


but this happens

user.php
Code:
// CREATE ACCOUNT
function user_create_account($register_data) {
    array_walk($register_data, 'array_sanitize');
  
    if (config('TFSVersion') == 'TFS_03' && config('salt') === true) {
        $register_data['salt'] = generate_recovery_key(18);
        $register_data['password'] = sha1($register_data['salt'].$register_data['password']);
    } else $register_data['password'] = sha1($register_data['password']);
  
    $ip = $register_data['ip'];
    $created = $register_data['created'];
    $flag = $register_data['flag'];              //<--------- line 1054

    unset($register_data['ip']);
    unset($register_data['created']);
  
    if (config('TFSVersion') == 'TFS_10') $register_data['creation'] = $created;

    $fields = '`'. implode('`, `', array_keys($register_data)) .'`';
    $data = '\''. implode('\', \'', $register_data) .'\'';

    mysql_insert("INSERT INTO `accounts` ($fields) VALUES ($data)");
  
    $account_id = user_id($register_data['name']);
    mysql_insert("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`, `flag`) VALUES ('$account_id', '$ip', '$created','$flag')");
  
    //TO-DO: mail server and verification.
    // http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
}
 
My guess is that the flag value is not defined, aka not pushed.
Check user_creature_account(array) function to see if it's even added.
 
Okey :D
first problem solved



in localhost


but this happened in characterprofile.php



Code:
<?php require_once 'engine/init.php'; include 'layout/overall/header.php';
if ($config['log_ip']) {
        znote_visitor_insert_detailed_data(4);
}
if (isset($_GET['name']) === true && empty($_GET['name']) === false) {
        $name = $_GET['name'];
      
        if (user_character_exist($name)) {
                $user_id = user_character_id($name);
                if ($config['TFSVersion'] == 'TFS_10') {
                        $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin');
                        $profile_data['online'] = user_is_online_10($user_id);
                } else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'online');
line 14   - ->    $flag = $profile_data['account_id'];
            $account_data = user_znote_account_data($account_id, 'flag');
            $getflag = mysql_select_single("SELECT * FROM znote_accounts WHERE account_id = '$flag'");
            $parseflag = user_character_account_id($getflag);
                $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
              
                $guild_exist = false;
                if (get_character_guild_rank($user_id) > 0) {
                        $guild_exist = true;
                        $guild = get_player_guild_data($user_id);
                        $guild_name = get_guild_name($guild['guild_id']);
                }
                ?>
 
Check the function;
Code:
user_character_data

Aswell as the arguments it sends.
 
Code:
$getflag = mysql_select_single("SELECT * FROM znote_accounts WHERE account_id = '$flag'");

$flag =/= account_id, because account_id returns number, and $flag returns f.ex. ad, like on screen you provided (that from db).


I think to get a flag you need to add here:
Code:
$profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin');

, 'flag' and then edit this:
Code:
line 14 - -> $flag = $profile_data['account_id'];
To this:
Code:
$flag = $profile_data['flag'];
 
Last edited:
Okey, I did

and it appears



Code:
        if (user_character_exist($name)) {
                $user_id = user_character_id($name);
                if ($config['TFSVersion'] == 'TFS_10') {
                        $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'flag');
                        $profile_data['online'] = user_is_online_10($user_id);
                } else $profile_data = user_character_data($user_id, 'name', 'level', 'vocation', 'lastlogin', 'online');
        $flag = $profile_data['flag'];
$getflag = mysql_select_single("SELECT * FROM znote_accounts WHERE account_id = '$flag'");
        $parseflag = user_character_account_id($getflag);     
                $profile_znote_data = user_znote_character_data($user_id, 'created', 'hide_char', 'comment');
 
Ok, step back all what I wrote in prev post, because there is no column 'flag' in players table.

To make it work, you must select flag from znote_accounts, join there players table, where id = account_id of player you are looking at characterprofile.php
 
yes yes, the problem was resolved

but the flag does not appear


Code:
 <li><font class="profile_font" name="profile_font_country">Country: <?php echo '<img src="\flags\\'.$parseflag['flag'].'.png">'; ?></font></li>
 
perfect, so it should be
Z2sTQ4W6w.png

Code:
<li><font class="profile_font" name="profile_font_country">Country: <?php echo '<img src="flags/'.$parseflag['flag'].'.png">'; ?></font></li>

but I think not quite right this

Code:
<img src="flags/'.$parseflag['flag'].'.png">

with this
Code:
$parseflag = user_character_account_id($getflag);

or yes?



 
hahah okey
but nothing happened

Code:
<li><font class="profile_font" name="profile_font_country">Country: <?php echo '<img src="flags/'.$parseflag['flag'].'.png"/>'; ?></font></li>
d_3p8Evbg.png
 
Check this broke img in Development Tools, and see how the link looks, or what is there displayed.
 
This is a updated version wroted by me but the idea and base was formed by @Raggaer

What I did was using Znote inbuild functions for cleaner code + By an idea of @Znote of using the znote structure instead of altering the tfs original tables.

What you need to add only to the database to make it all work is

Code:
ALTER TABLE `znote_accounts`
ADD `flag` VARCHAR( 20 ) NOT NULL;

Download : http://www43.zippyshare.com/v/tpSWRg5w/file.html
Github changed made : https://github.com/Tandloze/ZnoteAAC/commit/9891c9859e6f9a2e89b43af7d13448cac5d07e85
 
Last edited by a moderator:
Back
Top