E
Evil Puncker
Guest
nice, we are getting more closer------------------------------------------------------
FIRST CHARACTER CREATED WITH NEW ACCOUNT MAKER - 2011-07-07 22:24
------------------------------------------------------
nice, we are getting more closer------------------------------------------------------
FIRST CHARACTER CREATED WITH NEW ACCOUNT MAKER - 2011-07-07 22:24
------------------------------------------------------
It's looking really sick, great work!
<?PHP
$_web_config['formSize'] = 25;
$_web_config['useVerifyImage'] = false;
$_web_config['sendMailWithNewPassword'] = false;
?>
<?PHP
if($VISITOR->isLogged())
{
$errors = new Errors();
$didChangePassword = false;
$newAccountConfig = Website::getPageConfig(array('account', 'create'));
if($newAccountConfig->getErrorsCount() > 0)
new Error_Critic('', 'Cannot load config file of page <b>/account/create</b>', $newAccountConfig->getErrorsList());
$changePasswordConfig = Website::getPageConfig(array('account', 'password', 'change'));
if($changePasswordConfig->getErrorsCount() > 0)
new Error_Critic('', 'Cannot load config file of page <b>/account/password/change</b>', $changePasswordConfig->getErrorsList());
$changePasswordForm = new Form();
$field = new FormField_Password();
$field->setName('accountOldPassword');
if($newAccountConfig->isSetKey('passwordMaximumLenght'))
$field->setMaxLenght($newAccountConfig->getValue('passwordMaximumLenght'));
if($newAccountConfig->isSetKey('formSize'))
$field->setSize($newAccountConfig->getValue('formSize'));
$field->setLoadUserValue(true);
$changePasswordForm->addField($field);
$field = new FormField_Password();
$field->setName('accountNewPassword');
if($newAccountConfig->isSetKey('passwordMaximumLenght'))
$field->setMaxLenght($newAccountConfig->getValue('passwordMaximumLenght'));
if($newAccountConfig->isSetKey('formSize'))
$field->setSize($newAccountConfig->getValue('formSize'));
$field->setLoadUserValue(true);
$changePasswordForm->addField($field);
$field = new FormField_Password();
$field->setName('accountNewPasswordRepeat');
if($newAccountConfig->isSetKey('passwordMaximumLenght'))
$field->setMaxLenght($newAccountConfig->getValue('passwordMaximumLenght'));
if($newAccountConfig->isSetKey('formSize'))
$field->setSize($newAccountConfig->getValue('formSize'));
$field->setLoadUserValue(true);
$changePasswordForm->addField($field);
$field = new FormField_Submit();
$field->setName('change');
$field->setValue('Change Password');
$field->setStyle('font-size', '24px');
$changePasswordForm->addField($field);
if($changePasswordForm->isSetFieldValue('change'))
{
if(!$changePasswordForm->isSetFieldValue('accountOldPassword'))
$errors->addError('', 'You must fill field <b>Old Password</b>');
if(!$changePasswordForm->isSetFieldValue('accountNewPassword') || $changePasswordForm->getFieldValue('accountNewPassword') == '')
$errors->addError('', 'You must fill field <b>New Password</b>');
if(!$changePasswordForm->isSetFieldValue('accountNewPasswordRepeat') || $changePasswordForm->getFieldValue('accountNewPasswordRepeat') == '')
$errors->addError('', 'You must fill field <b>Repeat New Password</b>');
if($errors->isErrorsListEmpty() && $changePasswordForm->getFieldValue('accountNewPassword') != $changePasswordForm->getFieldValue('accountNewPasswordRepeat'))
$errors->addError('', '<b>New Password</b> and <b>Repeat New Password</b> are not equal');
if($errors->isErrorsListEmpty() && $newAccountConfig->isSetKey('passwordAllowedLetters') && strspn($changePasswordForm->getFieldValue('accountNewPassword'), $newAccountConfig->getValue('passwordAllowedLetters')) != strlen($changePasswordForm->getFieldValue('accountNewPassword')))
$errors->addError('', '<b>Password</b> contains illegal characters, use only: <b>' . $newAccountConfig->getValue('passwordAllowedLetters') . '</b>');
if($errors->isErrorsListEmpty() && $newAccountConfig->isSetKey('passwordMaximumLenght') && strlen($changePasswordForm->getFieldValue('accountNewPassword')) > $newAccountConfig->getValue('passwordMaximumLenght'))
$errors->addError('', '<b>Password</b> is too long. Maximum: <b>' . $newAccountConfig->getValue('passwordMaximumLenght') . '</b> letters');
if($errors->isErrorsListEmpty() && $newAccountConfig->isSetKey('passwordMinimumLenght') && strlen($changePasswordForm->getFieldValue('accountNewPassword')) < $newAccountConfig->getValue('passwordMinimumLenght'))
$errors->addError('', '<b>Password</b> is too short. Minimum: <b>' . $newAccountConfig->getValue('passwordMinimumLenght') . '</b> letters');
if($errors->isErrorsListEmpty() && $changePasswordConfig->isSetKey('useVerifyImage') && $changePasswordConfig->getValue('useVerifyImage') && (!Recaptcha::didUserSentCode() || !Recaptcha::isValidCode()))
$errors->addError('', 'Invalid <b>code from image</b>');
if($errors->isErrorsListEmpty())
{
$account = $VISITOR->getAccount();
if($account->getPassword() == Website::getInstance()->encryptPassword($changePasswordForm->getFieldValue('accountOldPassword')))
{
if(Website::getInstance()->encryptPassword($changePasswordForm->getFieldValue('accountNewPassword')) != $account->getPassword())
{
$account->setPassword(Website::getInstance()->encryptPassword($changePasswordForm->getFieldValue('accountNewPassword')));
$account->save();
$VISITOR->setPassword($changePasswordForm->getFieldValue('accountNewPassword'));
}
$didChangePassword = true;
echo '<div class="bigTitle">Password Changed</div><br />';
echo 'Now you can <a href="' . new Link('account', array('view')) . '">GO BACK</a> to your account.';
if($changePasswordConfig->isSetKey('sendMailWithNewPassword') && $changePasswordConfig->getValue('sendMailWithNewPassword') && Website::getInstance()->canSendMail())
{
if(Website::getInstance()->sendMail(
$account->getMail(),
Display::getServerName() . ' - Change password',
'<h2>You have changed password to account on server ' . htmlspecialchars(Display::getServerName()) . '</h2>Here are updated informations about your account.<br />Name: <b>' . htmlspecialchars($account->getName()) . '</b><br />Password: <b> ' . htmlspecialchars($changePasswordForm->getFieldValue('accountNewPassword')) . '</b>',
true))
echo '<br />We sent you e-mail with new password.';
else
echo '<br />Unknown error occured. We cannot send you e-mail with account name and password, but password changed.';
}
}
else
$errors->addError('', 'Invalid password to account. Try again.');
}
}
if(!$didChangePassword)
{
echo '<div class="bigTitle">Change Password</div><ve br />';
Display::printErrors($errors->getErrorsList());
echo $changePasswordForm->getString_Form();
$table = new Table();
$row = new TableRow();
$row->addCell(new TableCell('Current Password:'));
$row->addCell(new TableCell($changePasswordForm->getField('accountOldPassword')));
$table->addRow($row);
$row = new TableRow();
$row->addCell(new TableCell('New Password:'));
$row->addCell(new TableCell($changePasswordForm->getField('accountNewPassword')));
$table->addRow($row);
$row = new TableRow();
$row->addCell(new TableCell('Repeat New Password:'));
$row->addCell(new TableCell($changePasswordForm->getField('accountNewPasswordRepeat')));
$table->addRow($row);
if($changePasswordConfig->isSetKey('useVerifyImage') && $changePasswordConfig->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($changePasswordForm->getField('change')));
$row->setStyle('height', '40px');
$row->setStyle('vertical-align' , 'bottom');
$table->addRow($row);
echo $table;
echo $changePasswordForm->getString_FormEnd();
}
}
else
Website::redirect('', 'account', array('login', Website::saveSessionData()));
?>
Maybe you don't read my post in this thread... I don't use function 'addslashes' in my script.Why is the execution time so high?
Also, stop using add_slashes on inputs, and leaving them.
Maybe you don't read my post in this thread... I don't use function 'addslashes' in my script.
Why Xanteria - Account execution time is high? Hmm.. maybe, because it's on free web host. Other problem can be that mysql database is on my dedic in OVH (France) and cba.pl is in LeaseWeb (Netherlands).
Page without connection to database is:
Xanteria - Information
(don't forget to logout first)
Thanks for reportI haven't went through your code, or read your post, but after seeing your 'live preview' and typing apostrophes in input, after submitting they become \'\"
give us some newwwwwwwwwwssssss gesior!!!! :w00t:
<?PHP
if($VISITOR->isLogged())
{
$errors = new Errors();
$didCreateCharacter = false;
$createCharacterConfig = Website::getPageConfig(array('character', 'create'));
if($createCharacterConfig->getErrorsCount() > 0)
new Error_Critic('', 'Cannot load config file of page <b>/character/create</b>', $createCharacterConfig->getErrorsList());
$characterNameConfig = Website::getConfig(array('player', 'name'));
if($createCharacterConfig->getErrorsCount() > 0)
new Error_Critic('', 'Cannot load config file of page <b>/character/create</b>', $characterNameConfig->getErrorsList());
$createCharacterForm = new Form();
$field = new FormField_Text();
$field->setName('characterName');
if($characterNameConfig->isSetKey('nameMaximumLenght'))
$field->setMaxLenght($characterNameConfig->getValue('nameMaximumLenght'));
if($createCharacterConfig->isSetKey('formSize'))
$field->setSize($createCharacterConfig->getValue('formSize'));
$field->setLoadUserValue(true);
$createCharacterForm->addField($field);
if(count($createCharacterConfig->getValue('vocationsAllowed')) > 1)
{
foreach($createCharacterConfig->getValue('vocationsAllowed') as $id => $data)
{
$field = new FormField_Radio();
$field->setName('characterVocation');
$field->setValue($id);
$field->setLoadUserValue(true);
$createCharacterForm->addField($field, $id);
}
}
else
{
$field = new FormField_Hidden();
$field->setName('characterVocation');
$field->setValue(array_shift(array_keys($createCharacterConfig->getValue('vocationsAllowed'))));
$createCharacterForm->addField($field);
}
if(count($createCharacterConfig->getValue('sexAllowed')) > 1)
{
foreach($createCharacterConfig->getValue('sexAllowed') as $id => $data)
{
$field = new FormField_Radio();
$field->setName('characterSex');
$field->setValue($id);
$field->setLoadUserValue(true);
$createCharacterForm->addField($field, $id);
}
}
else
{
$field = new FormField_Hidden();
$field->setName('characterSex');
$field->setValue(array_shift(array_values($createCharacterConfig->getValue('sexAllowed'))));
$createCharacterForm->addField($field);
}
if($createCharacterConfig->getValue('townsUserSelect') && count($createCharacterConfig->getValue('townsAllowed')) > 1)
{
foreach($createCharacterConfig->getValue('townsAllowed') as $id => $data)
{
$field = new FormField_Radio();
$field->setName('characterTown');
$field->setValue($id);
$field->setLoadUserValue(true);
$createCharacterForm->addField($field, $id);
}
}
else
{
$field = new FormField_Hidden();
$field->setName('characterTown');
$field->setValue(array_shift(array_values($createCharacterConfig->getValue('townsAllowed'))));
$createCharacterForm->addField($field);
}
$field = new FormField_Submit();
$field->setName('create');
$field->setValue('Create Character');
$field->setStyle('font-size', '24px');
$createCharacterForm->addField($field);
if($createCharacterForm->isSetFieldValue('create'))
{
if(!$createCharacterForm->isSetFieldValue('characterName') || $createCharacterForm->getFieldValue('characterName') == '')
$errors->addError('', 'You must fill field <b>Name</b>');
if(!$createCharacterForm->isSetFieldValue('characterVocation') || $createCharacterForm->getFieldValue('characterVocation') == '')
$errors->addError('', 'You must select <b>Vocation</b>');
if(!$createCharacterForm->isSetFieldValue('characterSex') || $createCharacterForm->getFieldValue('characterSex') == '')
$errors->addError('', 'You must select <b>Sex</b>');
if(!$createCharacterForm->isSetFieldValue('characterTown') || $createCharacterForm->getFieldValue('characterTown') == '')
$errors->addError('', 'You must select <b>Town</b>');
if($errors->isErrorsListEmpty())
{
list($isValidName, $nameError, $nameFixed) = Functions::isValidNewPlayerName($createCharacterForm->getFieldValue('characterName'));
if(!$isValidName)
$errors->addError('', $nameError);
elseif($nameFixed != $createCharacterForm->getFieldValue('characterName'))
{
$errors->addError('', 'Server rules changed your name to <b>' . htmlspecialchars($nameFixed) . '</b>, you cannot use <b><i>' . $createCharacterForm->getFieldValue('characterName') . ' </i></b><br />If you accept it, press Create Character');
$createCharacterForm->getField('characterName')->setValue($nameFixed);
}
}
if($errors->isErrorsListEmpty() && !array_key_exists($createCharacterForm->getFieldValue('characterVocation'), $createCharacterConfig->getValue('vocationsAllowed')))
$errors->addError('', '<b>Vocation</b> has invalid value. Unexpected error.');
if($errors->isErrorsListEmpty() && !in_array($createCharacterForm->getFieldValue('characterSex'), $createCharacterConfig->getValue('sexAllowed')))
$errors->addError('', '<b>Sex</b> has invalid value. Unexpected error.');
if($errors->isErrorsListEmpty() && $createCharacterConfig->getValue('townsUserSelect') && !in_array($createCharacterForm->getFieldValue('characterTown'), $createCharacterConfig->getValue('townsAllowed')))
$errors->addError('', '<b>Town</b> has invalid value. Unexpected error.');
if($errors->isErrorsListEmpty())
{
$isAlreadyCharacter = new Player($createCharacterForm->getFieldValue('characterName'), Player::LOADTYPE_NAME);
if(!$isAlreadyCharacter->isLoaded())
{
$characters = $createCharacterConfig->getValue('vocationsAllowed');
$newPlayer = new Player($characters[$createCharacterForm->getFieldValue('characterVocation')]['characterToCopy'], Player::LOADTYPE_NAME);
$newPlayer->setName(ucwords(trim($createCharacterForm->getFieldValue('characterName'))));
$newPlayer->setAccountId($VISITOR->getAccount()->getId());
if($createCharacterConfig->isSetKey('newPlayerGroupId'))
$newPlayer->setGroupId($createCharacterConfig->getValue('newPlayerGroupId'));
else
$newPlayer->setGroupId(1);
$newPlayer->setCreateIP(ip2long($_SERVER['REMOTE_ADDR']));
$newPlayer->setCreateDate(time());
if($createCharacterConfig->isSetKey('sexUserSelect') && $createCharacterConfig->getValue('sexUserSelect'))
$newPlayer->setSex($createCharacterForm->getFieldValue('characterSex'));
else
{
$_sex = $createCharacterConfig->getValue('sexAllowed');
$newPlayer->setSex($_towns[rand(0,(count($_towns) - 1))]);
}
if($createCharacterConfig->isSetKey('townsUserSelect') && $createCharacterConfig->getValue('townsUserSelect'))
$newPlayer->setTown($createCharacterForm->getFieldValue('characterTown'));
else
{
$_towns = $createCharacterConfig->getValue('townsAllowed');
$newPlayer->setTown($_towns[rand(0,(count($_towns) - 1))]);
}
if($createCharacterConfig->isSetKey('townsSpawnInTemple') && $createCharacterConfig->getValue('townsSpawnInTemple'))
{
$newPlayer->setPosX(0);
$newPlayer->setPosY(0);
$newPlayer->setPosZ(0);
}
$newPlayer->setId(null); // insert on save
$newPlayer->save(true);
$didCreateCharacter = true;
echo '<div class="bigTitle">Character <b>' . $newPlayer->getName() . '</b> created</div><br />';
echo 'Now you can <a href="' . new Link('account', array('view')) . '">GO BACK</a>';
}
else
$errors->addError('', 'Character with name <b>' . htmlspecialchars($createCharacterForm->getFieldValue('characterName')) . '</b> already exists');
}
}
if(!$didCreateCharacter)
{
echo '<div class="bigTitle">Create character</div><br />';
Display::printErrors($errors->getErrorsList());
echo $createCharacterForm->getString_Form();
$table = new Table();
$row = new TableRow();
$row->addCell(new TableCell('Name:'));
$row->addCell(new TableCell($createCharacterForm->getField('characterName')));
$table->addRow($row);
if(count($createCharacterConfig->getValue('vocationsAllowed')) > 1)
{
$row = new TableRow();
$row->addCell(new TableCell('Vocation:'));
$cell = new TableCell();
$_table_content = array();
foreach($createCharacterConfig->getValue('vocationsAllowed') as $id => $data)
$_table_content[] = $createCharacterForm->getField('characterVocation', $id) . ' ' . $data['name'];
$cell->setContent(implode('<br />', $_table_content));
$cell->setStyle('width', '150px');
$row->addCell($cell);
$table->addRow($row);
}
else
echo $createCharacterForm->getField('characterVocation');
if(count($createCharacterConfig->getValue('sexAllowed')) > 1)
{
$row = new TableRow();
$row->addCell(new TableCell('Sex:'));
$cell = new TableCell();
$_table_content = array();
foreach($createCharacterConfig->getValue('sexAllowed') as $id => $data)
$_table_content[] = $createCharacterForm->getField('characterSex', $id) . ' ' . $WEB->getSexName($id);
$cell->setContent(implode('<br />', $_table_content));
$cell->setStyle('width', '150px');
$row->addCell($cell);
$table->addRow($row);
}
else
echo $createCharacterForm->getField('characterSex');
if($createCharacterConfig->getValue('townsUserSelect') && count($createCharacterConfig->getValue('townsAllowed')) > 1)
{
$row = new TableRow();
$row->addCell(new TableCell('Town:'));
$cell = new TableCell();
$_table_content = array();
foreach($createCharacterConfig->getValue('townsAllowed') as $id => $data)
$_table_content[] = $createCharacterForm->getField('characterTown', $id) . ' ' . $WEB->getTownName($id);
$cell->setContent(implode('<br />', $_table_content));
$cell->setStyle('width', '150px');
$row->addCell($cell);
$table->addRow($row);
}
else
echo $createCharacterForm->getField('characterTown');
$row = new TableRow();
$row->addCell(new TableCell(''));
$row->addCell(new TableCell($createCharacterForm->getField('create')));
$row->setStyle('height', '40px');
$row->setStyle('vertical-align' , 'bottom');
$table->addRow($row);
echo $table;
echo $createCharacterForm->getString_FormEnd();
}
}
else
Website::redirect('', 'account', array('login', Website::saveSessionData()));
?>
<?PHP
$_web_config['formSize'] = 25;
$_web_config['useVerifyImage'] = false;
$_web_config['newPlayerGroupId'] = 1;
$_web_config['copyItems'] = true;
$_web_config['copySkills'] = true;
$_web_config['townsAllowed'] = array(1);
$_web_config['townsUserSelect'] = false;
$_web_config['townsSpawnInTemple'] = true;
$_web_config['sexAllowed'] = array(0, 1);
$_web_config['sexUserSelect'] = true;
$_web_config['vocationsShowInfo'] = true;
$_web_config['vocationsShowDescription'] = true;
$_web_config['vocationsAllowed'][0]['characterToCopy'] = 'Sorcerer Sample';
$_web_config['vocationsAllowed'][0]['name'] = 'Sorcerer';
$_web_config['vocationsAllowed'][0]['description'] = 'aaaaaaaaaaaa';
$_web_config['vocationsAllowed'][1]['characterToCopy'] = 'Druid Sample';
$_web_config['vocationsAllowed'][1]['name'] = 'Druid';
$_web_config['vocationsAllowed'][1]['description'] = 'bbbbbbbbbbbbbbbbbb';
$_web_config['vocationsAllowed'][2]['characterToCopy'] = 'Paladin Sample';
$_web_config['vocationsAllowed'][2]['name'] = 'Paladin';
$_web_config['vocationsAllowed'][2]['description'] = 'ccccccccccccccccccc';
$_web_config['vocationsAllowed'][3]['characterToCopy'] = 'Knight Sample';
$_web_config['vocationsAllowed'][3]['name'] = 'Knight';
$_web_config['vocationsAllowed'][3]['description'] = 'dddddddddddddddddddddddd';
?>
<?PHP
$_web_config['nameMinimumLenght'] = 1;
$_web_config['nameMaximumLenght'] = 30;
$_web_config['nameAllowedLetters'] = "qwertyuiopasdfghjklzxcvbnmQWERTYUIOPASDFGHJKLZXCVBNM-' ";
$_web_config['nameMaxSameLetters'] = 2;
$_web_config['nameFirstWordsBlocked'] = array('god ', 'cm ', 'gm ', 'tutor ', 'admin ', 'hoster ', '-', "'", ' ');
$_web_config['nameLastWordsBlocked'] = array('-', "'", ' ');
$_web_config['nameWordsBlocked'] = array('account manager', 'gamemaster', 'game master', 'game-master', "game'master", '--', '- ', ' -', ' ', "''", "' ", " '", "'-", "-'");
$_web_config['nameFirstLettersUpper'] = true;
?>
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