Nutaharion
New Member
@up:
Have you ever heard of using Google? Also I have answered you how to fix this using PHP config file few days ago on Polish Board.
I just do it for others ^,^
@Evil
What you prefer to use?
@up:
Have you ever heard of using Google? Also I have answered you how to fix this using PHP config file few days ago on Polish Board.
Your new acc maker will solve problem with newests version;s of XAMPP? 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
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');
}
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;}
}
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 xamppmake it possible to use with uniserver ;-)
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__ :$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');
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.What's up with everyone having that damn hover effect on all tables no matter what? :S
bump for this, and, please make the links like this: localhost/?subtopic=something and no like this localhost/?page=account&0=login =/nice one, and about the guild part, are you going to make it compatible with elf war system?
It's ?page=xx&0=xx1&1=xx2, because it's compatible with /xx/xx1/xx2.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
<?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()));
?>
Ye. It will work in new acc. maker.Why do people want it this this way: localhost/?subtopic=account&something=blabla
Go with localhost/account/blabla, looks a lot better.