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

Sell Character Not work

nanduzenho

Member
Joined
Mar 21, 2021
Messages
187
Solutions
1
Reaction score
15
GitHub
nanduzenho
Good morning, I've implemented a sell character system, but I came across this error and I can't solve it. can anybody help me?ERRO SELL CHAR.PNG
sellcharacter.php

PHP:
$select_player_bank = function ($id) use ($config, $SQL, $account_logged) {
    $req = valida_multiplas_reqs();        <<<------ This line is 325
    if ($req) {
        if ($id > 0) {
            $val = $SQL->query("SELECT * FROM players WHERE id = $id AND account_id = {$account_logged->getID()}")->fetchAll();
            if (count($val) > 0) {
                $q = $SQL->prepare("UPDATE accounts SET player_sell_bank = $id WHERE id = {$account_logged->getID()}");
                $q->execute();
                $data = getStatus(false, 'You have successfully updated the player. If you sell any character via Gold, the gold will be delivered to him.');
                return json_encode($data);
            } else {
                $data = getStatus(TRUE, 'This player does not belong to you.');
                return json_encode($data);
            }
        } else {
            $data = getStatus(TRUE, 'Select a player!');
            return json_encode($data);
        }
    } else {
        $data = getStatus(TRUE, "Maximum number of requests per minute reached.");
        return json_encode($data);
    }
};
 
That function is not defined, look this repository that contains it.


PHP:
/** Função utilizada para validar multiplas requisições. */
function valida_multiplas_reqs()
{
    $timeout_time = Website::getWebsiteConfig()->getValue('timeout_time');
    $date = new DateTime();
    $now = $date->format('Y-m-d H:i:s');
    $valid = date_add($date, date_interval_create_from_date_string($timeout_time . ' minutes'))->format('Y-m-d H:i:s');
    $maxtries = Website::getWebsiteConfig()->getValue('max_req_tries');
    flushSession();
    $_SESSION['now'] = $now;
    if (!isset($_SESSION['valida'])) {
        $_SESSION['valida'] = $valid;
    }
    if (!isset($_SESSION['tries'])) {
        $_SESSION['tries'] = 0;
    }
    if ($_SESSION['now'] < $_SESSION['valida']) {
        if ($_SESSION['tries'] < $maxtries) {
            $_SESSION['tries'] = $_SESSION['tries'] + 1;
            return true;
        } else {
            return false;
        }
    } else {
        unset($_SESSION['valida'], $_SESSION['tries']);
        return false;
    }
}
 
That function is not defined, look this repository that contains it.

continue the error
Post automatically merged:

That function is not defined, look this repository that contains it.


PHP:
/** Função utilizada para validar multiplas requisições. */
function valida_multiplas_reqs()
{
    $timeout_time = Website::getWebsiteConfig()->getValue('timeout_time');
    $date = new DateTime();
    $now = $date->format('Y-m-d H:i:s');
    $valid = date_add($date, date_interval_create_from_date_string($timeout_time . ' minutes'))->format('Y-m-d H:i:s');
    $maxtries = Website::getWebsiteConfig()->getValue('max_req_tries');
    flushSession();
    $_SESSION['now'] = $now;
    if (!isset($_SESSION['valida'])) {
        $_SESSION['valida'] = $valid;
    }
    if (!isset($_SESSION['tries'])) {
        $_SESSION['tries'] = 0;
    }
    if ($_SESSION['now'] < $_SESSION['valida']) {
        if ($_SESSION['tries'] < $maxtries) {
            $_SESSION['tries'] = $_SESSION['tries'] + 1;
            return true;
        } else {
            return false;
        }
    } else {
        unset($_SESSION['valida'], $_SESSION['tries']);
        return false;
    }
}
Capturar.PNG
 
If u want, try this one, works fine for me.

Capturar.PNG
$this->data = $this->getDatabaseHandler()->query($query)->fetchAll();
Post automatically merged:

If u want, try this one, works fine for me.

must be the database, do you have it?
 
Last edited:
Back
Top