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

Solved Site problem(s)!

Testerus

Intermediate OT User
Joined
Mar 18, 2014
Messages
673
Reaction score
126
Hello everyone,
I have been getting 2 errors with my site.
I'm using gesior-aac-0.6.3.

First of all, when trying to log in (from any account), I get this message:
Fatal error: Call to a member function fetchAll() on a non-object in C:\xampp\htdocs\classes\databaselist.php on line 68

And the server appears OFFLINE everytime, even if closed or running.
9c51c1eb38
image: http://2imgs.com/9c51c1eb38
 
Here it is:
Code:
<?php
if(!defined('INITIALIZED'))
    exit;

class DatabaseList extends DatabaseHandler implements Iterator, Countable
{
    public $data;
    public $iterator = 0;
    public $class;
    public $table;
    public $tables = array();
    public $fields = array();
    public $extraFields = array();
    public $filter;
    public $orders = array();
    public $limit;
    public $offset = 0;

    public function __construct($class = null)
    {
        if($class !== null)
            $this->setClass($class);
    }

    public function load()
    {
        $fieldsArray = array();

        if(count($this->fields) > 0)
            foreach($this->fields as $fieldName)
                    $fieldsArray[$fieldName] = $this->getDatabaseHandler()->tableName($this->table) . '.' . $this->getDatabaseHandler()->fieldName($fieldName);

        if(count($this->extraFields) > 0)
            foreach($this->extraFields as $field)
                if(!$field->hasAlias())
                    $fieldsArray[] = $this->getDatabaseHandler()->tableName($field->getTable()) . '.' . $this->getDatabaseHandler()->fieldName($field->getName());
                else
                    $fieldsArray[] = $this->getDatabaseHandler()->tableName($field->getTable()) . '.' . $this->getDatabaseHandler()->fieldName($field->getName()) . ' AS ' . $this->getDatabaseHandler()->fieldName($field->getAlias());

        $tables = array();
        foreach($this->tables as $table)
            $tables[] = $this->getDatabaseHandler()->tableName($table);

        $filter = '';
        if($this->filter !== null)
            $filter = ' WHERE ' .$this->filter->__toString();

        $order = '';
        $orders = array();
        if(count($this->orders) > 0)
        {
            foreach($this->orders as $_tmp_order)
                $orders[] = $_tmp_order->__toString();
            if(count($orders) > 0)
                $order = ' ORDER BY ' . implode(', ', $orders);
        }

        $limit = '';
        if($this->limit !== null)
            $limit = ' LIMIT ' . (int) $this->limit;

        $offset = '';
        if($this->offset > 0)
            $offset = ' OFFSET ' . (int) $this->offset;

        $query = 'SELECT ' . implode(', ', $fieldsArray) . ' FROM ' . implode(', ', $tables) . $filter . $order . $limit . $offset;

        $this->data = $this->getDatabaseHandler()->query($query)->fetchAll();
    }

    public function getResult($id)
    {
        if(!isset($this->data))
            $this->load();
        if(isset($this->data[$id]))
        {
            if(!is_object($this->data[$id]))
            {
                $_tmp = new $this->class();
                $_tmp->loadData($this->data[$id]);
                return $_tmp;
            }
            else
                return $this->data[$id];
        }
        else
            return false;
    }

    public function addExtraField($field)
    {
        $this->extraFields[] = $field;
        $this->addTables($field->getTable());
    }

    public function addOrder($order)
    {
        $this->orders[] = $order;
    }

    public function setClass($class)
    {
        $this->class = $class;
        $instance = new $this->class();
        $this->fields = $instance::$fields;
        if(isset($instance::$extraFields))
            foreach($instance::$extraFields as $extraField)
            {
                if(!isset($extraField[2]))
                    $this->extraFields[] = new SQL_Field($extraField[0], $extraField[1]);
                else
                    $this->extraFields[] = new SQL_Field($extraField[0], $extraField[1], $extraField[2]);
                $this->tables[$extraField[1]] = $extraField[1];
            }
        $this->table = $instance::$table;
        $this->tables[$instance::$table] = $instance::$table;
    }

    public function setFilter($filter)
    {
        $this->addTables($filter->getTables());
        $this->filter = $filter;
    }

    public function setLimit($limit)
    {
        $this->limit = $limit;
    }

    public function setOffset($offset)
    {
        $this->offset = $offset;
    }

    public function addTables($tables)
    {
        if(is_array($tables))
        {
            foreach($tables as $table)
                if($table != '' && !in_array($table, $this->tables))
                    $this->tables[$table] = $table;
        }
        elseif($tables != '' && !in_array($tables, $this->tables))
            $this->tables[$tables] = $tables;
    }

    public function current()
    {
        return $this->getResult($this->iterator);
    }

    public function rewind()
    {
        if(!isset($this->data))
            $this->load();
        $this->iterator = 0;
    }

    public function next()
    {
        ++$this->iterator;
    }

    public function key()
    {
        return $this->iterator;
    }

    public function valid()
    {
        return isset($this->data[$this->iterator]);
    }

    public function count()
    {
        if(!isset($this->data))
            $this->load();
        return count($this->data);
    }
}
 
Still no one?
Isn't that supposed to be kind of easy?
Need help or bump. plz
 
Last edited:
Come on.
Please help, BUMP!

BUMP!!
Is it really that hard to solve this problem?:(
I posted the databaselist.php
 
Last edited by a moderator:
What account are u using ,Gesior?
But u use gesior
Your problem say OFFLINE
is in line 343~ config-and-functions
have this made by:
Code:
  $config['status']['serverStatus_checkInterval'] = $statustimeout+3;
  $config['status']['serverStatus_lastCheck'] = time();
  $info = chr(6).chr(0).chr(255).chr(255).'info';
  $sock = @fsockopen("localhost", $config['server']['statusPort'], $errno, $errstr, 1);
or other just need sure have this in
Code:
  $sock = @fsockopen("localhost", $config['server']['statusPort'], $errno, $errstr, 1);
! and try changed to:
Code:
  $config['status']['serverStatus_checkInterval'] = $statustimeout+3;
  $config['status']['serverStatus_lastCheck'] = time();
  $info = chr(6).chr(0).chr(255).chr(255).'info';
  $sock = @fsockopen("127.0.0.1", $config['server']['statusPort'], $errno, $errstr, 1);

and

your pedestal:
Code:
<div id="PlayersOnline" onClick="window.location='?subtopic=whoisonline'">
<?PHP
    $online = $SQL->query("SELECT COUNT(*) FROM players WHERE online > 0")->fetch();
    echo '<b>Players:</b>'.$online[0].'<br><b>Server Online</b>';
?>
</div>
or
Code:
<div id="PlayersOnline" onClick="window.location = '?subtopic=whoisonline'">
                <?PHP           
                $players = $SQL->query('SELECT * FROM players WHERE online = 1');
                $p_num = 0;
                foreach($players as $player) $p_num++;
                if($config['status']['serverStatus_online'] == 1)
                    echo ''.$p_num.'<br>Players Online';
                else
                    echo '<font color="red"><b>Server<br />Offline</b></font>';
                ?></div>
 
Last edited:
and database list ,are u sure only ge this error:
PHP:
 Fatal error: Call to a member function fetchAll() on a non-object in C:\xampp\htdocs\classes\databaselist.php on line 68
don't get other ?
 
What about try to google or search for same problem before you post next time? There are alot of threads out here with the same question and with many good answers.
 
Well, @byllan1337 you could atleast show me the thread or give a link, this way you help more people and it's easier for everyone.
Personally I searched and didn't find anything useful for my problem.

And @Cronox ; That's the only problem yes. And thanks for the help with the offline problem.

By the way, I switched to another AAC, but I am still interested in the problem; consider this as a BUMP.

Kind regards,
 
Back
Top Bottom