• 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 Acc Converted to 7.4

Ganjita

Active Member
Joined
Dec 15, 2009
Messages
494
Reaction score
37
Hello to all, someone can help me?, i have a znote acc converted for 7.4 but that have a "bug" when i create acc, for understand the bug see the pic:

jmga.png

when i create acc the" znote_table"s save all "new account_id" with "0", how i can repair that?

for example if i create a new acc " account_id=new acc "

PD: I use avesta rev 94 7.4

Thanks in advance
Regards
 
i found that on files: user.php --> http://pastebin.com/PBb3wkFe

PHP:
// 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'];
   
    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_query("INSERT INTO `accounts` ($fields) VALUES ($data)") or die(mysql_error());
   
    $account_id = user_id($register_data['name']);
    mysql_query("INSERT INTO `znote_accounts` (`account_id`, `ip`, `created`) VALUES ('$account_id', '$ip', '$created')") or die(mysql_error());
   
    //TO-DO: mail server and verification.
    // http://www.web-development-blog.com/archives/send-e-mail-messages-via-smtp-with-phpmailer-and-gmail/
}
 
Lets have a look at the account data you are trying to register.

After
PHP:
function user_create_account($register_data)
Write:
PHP:
echo '<pre>';
echo print_r($register_data);
echo '</pre><br>';
die("Script terminated for debugging purposes.");

Make an account with random/non personal data, then you will get to a white page with array data, post that here.

I think there is a problem with this line of code:
$account_id = user_id($register_data['name']);

Since user_id is probably trying to fetch account.id from account.name column (which don't exist on 7.4).
But if you intend to attempt to convert my AAC you should learn to debug it properly.

You can add this to general.php if it isn't there already for sweet easy debugging:
PHP:
<?
// Sweet error reporting
function data_dump($print = false, $var = false, $title = false) {
    if ($title !== false) echo "<pre><font color='red' size='5'>$title</font><br>";
    else echo '<pre>';
    if ($print !== false) {
        echo 'Print: - ';
        print_r($print);
        echo "<br>";
    }
    if ($var !== false) {
        echo 'Var_dump: - ';
        var_dump($var);
    }
    echo '</pre><br>';
}
?>

Then you could do something like
die(data_dump($register_data, false, "Register Data")); to easily present stored data.
 
I think he actually purchased the aac from someone :/
i think a bad buy :/

Lets have a look at the account data you are trying to register.

After
PHP:
function user_create_account($register_data)
Write:
PHP:
echo '<pre>';
echo print_r($register_data);
echo '</pre><br>';
die("Script terminated for debugging purposes.");

Make an account with random/non personal data, then you will get to a white page with array data, post that here.

I think there is a problem with this line of code:
$account_id = user_id($register_data['name']);

Since user_id is probably trying to fetch account.id from account.name column (which don't exist on 7.4).
But if you intend to attempt to convert my AAC you should learn to debug it properly.

You can add this to general.php if it isn't there already for sweet easy debugging:
PHP:
<?
// Sweet error reporting
function data_dump($print = false, $var = false, $title = false) {
    if ($title !== false) echo "<pre><font color='red' size='5'>$title</font><br>";
    else echo '<pre>';
    if ($print !== false) {
        echo 'Print: - ';
        print_r($print);
        echo "<br>";
    }
    if ($var !== false) {
        echo 'Var_dump: - ';
        var_dump($var);
    }
    echo '</pre><br>';
}
?>

Then you could do something like
die(data_dump($register_data, false, "Register Data")); to easily present stored data.

here is the aray from create account :

Code:
Array
(
    [id] => 987654
    [password] => ganja345
    [email] => [email protected]
    [ip] => 2130706433
    [created] => 1394062392
)
1

Script terminated for debugging purposes.

on my general.php i have the sweet error reporting and i really dont understand the last line

Code:
die(data_dump($register_data, false, "Register Data")); to easily present stored data.

im learn some php for repair that
 
here is the aray from create account :
Code:
Array
(
    [id] => 987654
    [password] => ganja345
    [email] => [email protected]
    [ip] => 2130706433
    [created] => 1394062392
)
1

Script terminated for debugging purposes.

Great, then you don't need to use an external function to fetch account id, so just change:
PHP:
$account_id = user_id($register_data['name']);
to
PHP:
$account_id = (int)$register_data['id'];

And that should work.

(Remember to remove the debugging lines I told you to add previously so the script don't terminate on purpose).
 
Great, then you don't need to use an external function to fetch account id, so just change:
PHP:
$account_id = user_id($register_data['name']);
to
PHP:
$account_id = (int)$register_data['id'];

And that should work.

(Remember to remove the debugging lines I told you to add previously so the script don't terminate on purpose).

i changed 2 lines with that and now i have that on all website

Code:
1

Script terminated for debugging purposes.
 
Great, then you don't need to use an external function to fetch account id, so just change:
PHP:
$account_id = user_id($register_data['name']);
to
PHP:
$account_id = (int)$register_data['id'];

And that should work.

(Remember to remove the debugging lines I told you to add previously so the script don't terminate on purpose).

i edit the wrong line, that found good, thanks!
 
Again..... example of shop system (npc)

Code:
local keywordHandler = KeywordHandler:new()
local npcHandler = NpcHandler:new(keywordHandler)
NpcSystem.parseParameters(npcHandler)

function onCreatureAppear(cid)            npcHandler:onCreatureAppear(cid)            end
function onCreatureDisappear(cid)        npcHandler:onCreatureDisappear(cid)            end
function onCreatureSay(cid, type, msg)    npcHandler:onCreatureSay(cid, type, msg)    end
function onThink()                        npcHandler:onThink()                        end

function creatureSayCallback(cid, type, msg)
    if(npcHandler.focus ~= cid) then
        return false
    end

    local accid = getAccountNumberByPlayerName(getPlayerName(cid))
    local orderQuery = mysqlQuery("SELECT `points` FROM `znote_accounts` WHERE `account_id` = ".. accid .." LIMIT 1;", "points")
    local shop_points = getNumberValue(orderQuery.points)

    if msgcontains(msg, "list") then
        npcHandler:say("Here you are.")
        doShowTextDialog(cid, 2195, "** Shop List **\n\nBoots of Haste [20 points]\nSoft Boots [50 points]")
       
    elseif msgcontains(msg, "boots of haste") then
        npcHandler:say('Do you want to buy 1 boots of haste for 20 points?')
        pontos = 20
        item_id = 2195
        quant = 1
        topic = 1
   
    elseif msgcontains(msg, "soft boots") then
        npcHandler:say('Do you want to buy 1 soft boots for 50 points?')
        pontos = 50
        item_id = 2640
        quant = 1
        topic = 1
   
    end
   
    -- Confirm Yes or No
    if topic == 1 and msgcontains(msg, "yes") then
        if shop_points > 0 then
            npcHandler:say("Enjoy it young adventurer!")
            doPlayerAddItem(cid, item_id, quant)
            mysqlQuery("UPDATE `znote_accounts` SET `points` = ".. shop_points - pontos .." WHERE `account_id` = ".. accid .." LIMIT 1;", "UPDATE")
            topic = 0
        else
            npcHandler:say('You do not have enough points!')
            topic = 0
        end
    else
        npcHandler:say("Sorry, but you are not allowed to buy equipments with me.")
    end
   
    return TRUE
end

npcHandler:setCallback(CALLBACK_MESSAGE_DEFAULT, creatureSayCallback)
npcHandler:addModule(FocusModule:new())
 
Back
Top