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

Gesior AAC 2011 - Needed? Ideas?

Your new acc maker will solve problem with newests version;s of XAMPP? :p Because now it sometimes show
Code:
Notice: Undefined index: page in C:\xampp\htdocs\install.php on line 40 

Notice: Undefined index: page in C:\xampp\htdocs\install.php on line 52 

Notice: Undefined index: page in C:\xampp\htdocs\install.php on line 63

I heard that it's possible to repair it in one of .php document, but I think that you will make it workable with XAMPP 1.7.7 without any edition's :D

New version will not show any error on new versions of PHP (xampp).
 
PlayerItems (load, edit, save) ready, Skills in Player class (load, edit, save) ready, DatabaseList class ready (for highscores, players lists).
PHP:
	public function getItems()
	{
		if(!isset($this->items))
			$this->items = new ItemsList($this->getID());

		return $this->items;
	}

	public function saveItems()
	{
		if(isset($this->items))
		{
			// if script changed ID of player, function should save items with new player id
			$this->items->setPlayerId($this->getID());
			$this->items->save();
		}
		else
			new Error_Critic('', 'Player::saveItems() - items not loaded, cannot save');
	}

	public function loadSkills()
	{
		$fieldsArray = array();
		foreach(self::$skillFields as $fieldName)
			$fieldsArray[] = $this->SQL->fieldName($fieldName);

		$skills = $this->SQL->query('SELECT ' . implode(', ', $fieldsArray) . ' FROM ' . $this->SQL->fieldName('player_skills') . ' WHERE ' . $this->SQL->fieldName('player_id') . ' = ' . $this->SQL->quote($this->getID()))->fetchAll();
		$this->skills = array();
		foreach($skills as $skill)
			$this->skills[$skill['skillid']] = $skill;
	}

	public function getSkills()
	{
		if(!isset($this->skills))
			$this->loadSkills();

		return $this->skills;
	}

	public function getSkill($id)
	{
		if(!isset($this->skills))
			$this->loadSkills();

		if(isset($this->skills[$id]))
			return $this->skills[$id]['value'];
		else
			new Error_Critic('', 'Player::getSkill() - Skill ' . htmlspecialchars($id) . ' does not exist');
	}

	public function setSkill($id, $value)
	{
		$this->skills[$id]['value'] = $value;
	}

	public function getSkillCount($id)
	{
		if(!isset($this->skills))
			$this->loadSkills();

		if(isset($this->skills[$id]))
			return $this->skills[$id]['count'];
		else
			new Error_Critic('', 'Player::getSkillCount() - Skill ' . htmlspecialchars($id) . ' does not exist');
	}

	public function setSkillCount($id, $count)
	{
		$this->skills[$id]['count'] = $count;
	}
	public function saveSkills()
	{
		if(isset($this->skills))
		{
			$this->SQL->query('DELETE FROM ' . $this->SQL->tableName('player_skills') . ' WHERE ' . $this->SQL->fieldName('player_id') . ' = ' . $this->SQL->quote($this->getID()));

			if(count($this->skills) > 0)
			{
				$keys = array();
				foreach(self::$skillFields as $key)
					$keys[] = $this->SQL->fieldName($key);

				$query = 'INSERT INTO `player_skills` (' . implode(', ', $keys) . ') VALUES ';
				$skills = array();
				foreach($this->skills as $skill)
				{
					$fieldValues = array();
					foreach(self::$skillFields as $key)
						if($key != 'player_id')
							$fieldValues[] = $this->SQL->quote($skill[$key]);
						else
							$fieldValues[] = $this->SQL->quote($this->getID());
					$skills[] = '(' . implode(', ', $fieldValues) . ')';
				}
				$this->SQL->query($query . implode(', ', $skills));
			}
		}
		else
			new Error_Critic('', 'Player::saveSkills() - skills not loaded, cannot save');
	}


PHP:
class ItemsList implements Iterator, Countable
{
	private $SQL;
	public $items;
	private $player_id = 0;
	private $iterator = 0;
	private static $fields = array('player_id', 'pid', 'sid', 'itemtype', 'count', 'attributes');

	public static function addField($name)
	{
		if(!in_array($name, self::$fields))
			self::$fields[] = $name;
	}

	public static function removeField($name)
	{
		if(in_array($name, self::$fields))
			unset(self::$fields[$name]);
	}

	public static function getFieldsList()
	{
		return self::$fields;
	}

    public function __construct($player_id = 0)
    {
        $this->SQL = Website::getInstance()->getDBHandle();
		if($player_id != 0)
			$this->setPlayerId($player_id);
    }

	public function load($player_id = 0)
	{
		if($player_id != 0)
			$this->setPlayerId($player_id);
		$this->items = array();
		$fieldsArray = array();
		foreach(self::$fields as $fieldName)
			$fieldsArray[$fieldName] = $this->SQL->fieldName($fieldName);
		$data = $this->SQL->query('SELECT ' . implode(', ', $fieldsArray) . ' FROM ' . $this->SQL->tableName('player_items') . ' WHERE ' . $this->SQL->fieldName('player_id') . ' = ' . $this->SQL->quote($this->getPlayerId()))->fetchAll();
		if(count($data) > 0)
			foreach($data as $i => $item)
			{
				$_new_items[$i] = new Item($item);
				$this->items[] = &$_new_items[$i];
			}
	}

	public function save($deleteCurrentItems = true)
	{
		if($deleteCurrentItems)
			$this->SQL->query('DELETE FROM ' . $this->SQL->tableName('player_items') . ' WHERE ' . $this->SQL->fieldName('player_id') . ' = ' . $this->SQL->quote($this->getPlayerId()));

		if(count($this->items) > 0)
		{
			$keys = array();
			foreach(self::$fields as $key)
				$keys[] = $this->SQL->fieldName($key);

			$query = 'INSERT INTO `player_items` (' . implode(', ', $keys) . ') VALUES ';
			$items = array();
			foreach($this->items as $item)
			{
				$fieldValues = array();
				foreach(self::$fields as $key)
					if($key != 'player_id')
						$fieldValues[] = $this->SQL->quote($item->data[$key]);
					else
						$fieldValues[] = $this->SQL->quote($this->player_id);
				$items[] = '(' . implode(', ', $fieldValues) . ')';
			}
			$this->SQL->query($query . implode(', ', $items));
		}
	}

	public function isLoaded()
	{
		return isset($this->player_id);
	}

	public function setPlayerId($value){$this->player_id = $value;}
	public function getPlayerId(){return $this->player_id;}

	public function getItem($pid, $sid = null){return $this->items[$pid];}

	public function getResult($id)
	{
		if(!isset($this->items))
			$this->load();
		if(isset($this->items[$id]))
			return $this->items[$id];
		else
			return false;
	}

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

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

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

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

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

    public function count()
    {
		if(!isset($this->items))
			$this->load();
        return count($this->items);
    }
}

class Item
{
	private $itemsList = null;
	public $data = array();

    public function __construct($data)
    {
		$this->load($data);
    }

	public function load($data)
	{
		$this->data = $data;
	}

	public function getPID(){return $this->data['pid'];}
	public function setPID($value){$this->data['pid'] = $value;}
	public function getSID(){return $this->data['sid'];}
	public function setSID($value){$this->data['sid'] = $value;}
	public function getID(){return $this->data['itemtype'];}
	public function setID($value){$this->data['itemtype'] = $value;}
	public function getCount(){return $this->data['count'];}
	public function setCount($value){$this->data['count'] = $value;}
	public function getAttributes(){return $this->data['attributes'];}
	public function setAttributes($value){$this->data['attributes'] = $value;}
	
	
}
 
make it possible to use with uniserver ;-)
xampp and uniformserv are nothing more than php, apache and mysql combined in one package... IMO the main difference between both is that xampp is more intended to be used for development and not for production use, btw uniserv got updated more than xampp
 
A small tip would be to use __METHOD__ (or __FUNCTION__ if you're not within a class) rather than manually typing the name into any exceptions being thrown.
PHP:
new Error_Critic('', 'Player::saveSkills() - skills not loaded, cannot save');
new Error_Critic('', __METHOD__ . '() - skills not loaded, cannot save');
 
A small tip would be to use __METHOD__ (or __FUNCTION__ if you're not within a class) rather than manually typing the name into any exceptions being thrown.
PHP:
new Error_Critic('', 'Player::saveSkills() - skills not loaded, cannot save');
new Error_Critic('', __METHOD__ . '() - skills not loaded, cannot save');
Oo I use __LINE__ and __FILE__ and forgot about __METHOD__ :$
Thank you for advice :thumbup:
 
View account page [after login], tables without colors and only few graphics, but works.
accountview.png

Load account, verify login, show e-mail etc. and list of 29 players from logged account in 0.014 sec, 2.1MB RAM and only 2 SQL queries ^_^
 
nice one, and about the guild part, are you going to make it compatible with elf war system?
 
Newest stable (working) version of AAC will be always available:
Xanteria - Account
Host: 3 euro/month virtual server, database is on other pc (dedic), so website sometimes loads 0.3 sec
Host PHP: 6 (dev)


AAC require minimum PHP 5.3, because in DatabaseList class is code that works only on versions >= 5.3
 
Last edited:
What's up with everyone having that damn hover effect on all tables no matter what? :S
 
What's up with everyone having that damn hover effect on all tables no matter what? :S
All is in layout .css files. Maybe I have darker monitor then you, because I need hover to see what is in which line. Bufo (layout author) said that he will fix layout to make it more readable.. maybe remove hover.
 
nice one, and about the guild part, are you going to make it compatible with elf war system?
bump for this, and, please make the links like this: localhost/?subtopic=something and no like this localhost/?page=account&amp0=login =/

btw this amp0 is... weird xD
 
Why do people want it this this way: localhost/?subtopic=account&something=blabla
Go with localhost/account/blabla, looks a lot better.
 
bump for this, and, please make the links like this: localhost/?subtopic=something and no like this localhost/?page=account&0=login =/

btw this amp0 is... weird xD
It's ?page=xx&amp0=xx1&amp1=xx2, because it's compatible with /xx/xx1/xx2.
This is code of /pages/character/delete/index.php:
PHP:
<?PHP
if($VISITOR->isLogged())
{	
	if(isset($_PARAM[0]))
	{
		$playerId = (int) $_PARAM[0];
		$player = new Player($playerId);
		if($player->isLoaded())
		{
			if($player->getAccountID() == $VISITOR->getAccount()->getID())
			{
				$errors = new Errors();
				$didDelete = false;

				$deleteCharacterConfig = Website::getPageConfig(array('character', 'delete'));
				if($deleteCharacterConfig->getErrorsCount() > 0)
					new Error_Critic('', 'Cannot load config file of page <b>/character/delete</b>', $deleteCharacterConfig->getErrorsList());

				$accountPasswordConfig = Website::getConfig(array('account', 'password'));
				if($accountPasswordConfig->getErrorsCount() > 0)
					new Error_Critic('', 'Cannot load config file <b>account_password</b>', $accountPasswordConfig->getErrorsList());

				$deleteForm = new Form();

				if($deleteCharacterConfig->isSetKey('requirePassword') && $deleteCharacterConfig->getValue('requirePassword'))
				{
					$field = new FormField_Password();
					$field->setName('accountPassword');
					if($accountPasswordConfig->isSetKey('passwordMaximumLenght'))
						$field->setMaxLenght($accountPasswordConfig->getValue('passwordMaximumLenght'));
					if($deleteCharacterConfig->isSetKey('formSize'))
						$field->setSize($deleteCharacterConfig->getValue('formSize'));
					$deleteForm->addField($field);
				}

				$field = new FormField_Submit();
				$field->setName('delete');
				$field->setClass('button_minidelete');
				$deleteForm->addField($field);

				if($deleteForm->isSetFieldValue('delete'))
				{
					if($deleteCharacterConfig->isSetKey('requirePassword') && $deleteCharacterConfig->getValue('requirePassword') && !$deleteForm->isSetFieldValue('accountPassword'))
						$errors->addError('', 'You must fill field <b>Password</b>');

					if($errors->isErrorsListEmpty() && $deleteCharacterConfig->isSetKey('useVerifyImage') && $deleteCharacterConfig->getValue('useVerifyImage') && (!Recaptcha::didUserSentCode() || !Recaptcha::isValidCode()))
						$errors->addError('', 'Invalid <b>code from image</b>');
			 
					if($errors->isErrorsListEmpty())
					{
						if(!$deleteCharacterConfig->isSetKey('requirePassword') || !$deleteCharacterConfig->getValue('requirePassword') || $VISITOR->getAccount()->getPassword() == Website::getInstance()->encryptPassword($deleteForm->getFieldValue('accountPassword')))
						{
							$didDelete = true;
							$player->setDeleted(true);
							$player->save();
							echo '<div class="bigTitle">Character ' . Display::playerName($player->getName(), $player->getOnline()) . ' deleted</div><br />';
							echo 'Now you can <a href="' . new Link('account', array('view')) . '">GO BACK</a> to your account.';
						}
						else
							$errors->addError('', 'Invalid password to account. Try again.');
					}
				}

				if(!$didDelete)
				{
					echo '<div class="bigTitle">Delete Character</div><ve br />';
					Display::printErrors($errors->getErrorsList());

					echo $deleteForm->getString_Form();

					$table = new Table();
					$table->setClass('normalTable');

					$row = new TableRow();
					$cell = new TableCell();
					$cell->setColSpan(2);
					$cell->setContent('Do you really want to delete character ' . Display::playerName($player->getName(), $player->getOnline()) . '?<br />Character will be not immediately removed from our database. It will be removed from characters list that you see when you login in game client. From database it will be removed for too long inactivity in few days/hours.');
					$row->addCell($cell);
					$table->addRow($row);

					if($deleteCharacterConfig->isSetKey('requirePassword') && $deleteCharacterConfig->getValue('requirePassword'))
					{
						$row = new TableRow();
						$row->addCell(new TableCell('Current Password:'));
						$row->addCell(new TableCell($deleteForm->getField('accountPassword')));
						$table->addRow($row);
					}

					if($deleteCharacterConfig->isSetKey('useVerifyImage') && $deleteCharacterConfig->getValue('useVerifyImage'))
					{
						$row = new TableRow();
						$cell = new TableCell();
						$cell->setColSpan(2);
						$cell->setContent(Recaptcha::getImageHTML());
						$row->addCell($cell);
						$table->addRow($row);
					}

					$row = new TableRow();
					$row->addCell(new TableCell(''));
					$row->addCell(new TableCell($deleteForm->getField('delete')));
					$row->setStyle('height', '40px');
					$row->setStyle('vertical-align' , 'bottom');
					$table->addRow($row);

					echo $table;

					echo $deleteForm->getString_FormEnd();
					echo '<div style="width:100%;height:45px;"><a href="' . new Link('account', array('view')) . '" class="button_back" style="margin-top:15px;margin-left:auto;margin-right:auto"></a></div>';
				}
			}
			else
				new Error_Critic('', 'This player is not on your account.');
		}
		else
			new Error_Critic('', 'Sorry, cannot load player ID: ' . $playerId);
	}
	else
		new Error_Critic('', 'Edit informations page require parameter. Unexpected error.');
}
else
	Website::redirect('', 'account', array('login', Website::saveSessionData()));
?>
You can open it by URL (to delete character id 15):
localhost/?page=character&amp0=delete&amp1=15
or:
localhost/character/delete/15
both work same, they run script in /pages/character/delete/, because folder '15' doesn't exist in 'delete' folder. And '15' you can find in $_PARAM :)
Why do people want it this this way: localhost/?subtopic=account&something=blabla
Go with localhost/account/blabla, looks a lot better.
Ye. It will work in new acc. maker.
 
Back
Top