• 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 Account name Check not working

GhostWD

I'm in love with the var_dump()
Joined
Jan 25, 2009
Messages
185
Solutions
6
Reaction score
29
Hi Otlanders as Title says i can't figure out why this isn't working cause i dont understand php totaly lame i'm using Gesior aac for materiaOTS when i input in Account Name account 'id' which is in data base its saays that its used by someone(that account 'name') but if i input 'name' which i want to be used and this 'name' is in database its says that its okay (but i cant create account returns error when i'm clicking i agree because there is account with this 'name')

How to make it work?

Here is code which i'm thinking is fault


PHP:
<?PHP
function check_account_name($name)//sprawdza name
{
    $temp = strspn("$name", "QWERTYUIOPASDFGHJKLZXCVBNM0123456789");
    if ($temp != strlen($name))
        return false;
    if(strlen($name) > 30)
        return false;
    else
    {
        $ok = "/[A-Z0-9]/";
        return (preg_match($ok, $name))? true: false;
    }
}
echo '<?xml version="1.0" encoding="utf-8" standalone="yes"?>';
$config_ini = parse_ini_file('../config/config.ini');
$account = strtoupper(trim($_REQUEST['account']));
if(empty($account))
{
    echo '<image src="../images/false.gif"> <font color="red">Please enter an account number.</font>';
    exit;
}
if(strlen($account) > 0 && strlen($account) < 31)
{
    if(!check_account_name($account))
    {
        echo '<image src="../images/false.gif"> <font color="red">Invalid account name format. Use only A-Z and numbers 0-9.</font>';
        exit;
    }
    //connect to DB
    $server_config = parse_ini_file($config_ini['server_path'].'config.lua');
    if(isset($server_config['sqlHost']))
    {
        $mysqlhost = $server_config['sqlHost'];
        $mysqluser = $server_config['sqlUser'];
        $mysqlpass = $server_config['sqlPass'];
        $mysqldatabase = $server_config['sqlDatabase'];
        $sqlitefile = $server_config['sqliteDatabase'];
    }
    // loads #####POT mainfile#####
    include('../pot/OTS.php');
    // PDO and POT connects to database
    $ots = POT::getInstance();
    if($server_config['sqlType'] == "mysql")
        $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase) );
    elseif($server_config['sqlType'] == "sqlite")
        $ots->connect(POT::DB_SQLITE, array('database' => $config_ini['server_path'].$sqlitefile));
    $account_db = new OTS_Account();
    $account_db->load($account);
    if($account_db->isLoaded())
        echo '<image src="../images/false.gif"> <font color="red">Account with this name already exist.</font>';
    else
        echo '<image src="../images/true.gif"> <font color="green">Your account name will be:  '.$account.'</font>';
}
else
    echo '<image src="../images/false.gif"> <font color="red">Account name is too long (max. 30 chars).</font>';
?>
 
Try replacing:
PHP:
    $account_db = new OTS_Account();
    $account_db->load($account);

With:
PHP:
    $account_db = new Account();
    $account_db->load($account, Account::LOADTYPE_NAME);
 
now it returns error
Code:
Fatal error: Class 'Account' not found in C:\aaxampp\htdocs\Nowy folder (2)\ajax\check_account.php on line 48
 
Back
Top