* @author Slawkens * @copyright 2017 MyAAC * @version 0.0.6 * @link http://my-aac.org */ defined('MYAAC') or die('Direct access not allowed!'); $title = 'Account Management'; if($config['account_country']) require(SYSTEM . 'countries.conf.php'); $groups = new OTS_Groups_List(); $dontshowtableagain = false; $config_salt_enabled = fieldExist('salt', 'accounts'); if(!$logged) { if($action == "logout") echo '
' . '' . '
' . '
' . '' . '' . '' . '' . '
Logout Successful
' . '
You have logged out of your '.$config['lua']['serverName'].' account. In order to view your account you need to log in again.
'; else { if(!empty($errors)) output_errors($errors); ?> Please enter your account name and your password.
Create an account if you do not have one yet.

Account Login
'; ?>
>Account :
>Password:
' . $errors[0] . '

Login Successful
You have logged in.
Press here if you are not returned automatically.
getCustomField("key"); if(!$account_logged->isPremium()) $account_status = 'Free Account'; else $account_status = 'Premium Account, '.$account_logged->getPremDays().' days left'; if(empty($account_reckey)) $account_registred = 'No'; else { if($config['generate_new_reckey'] && $config['mail_enabled']) $account_registred = 'Yes ( Buy new Recovery Key )'; else $account_registred = 'Yes'; } $account_created = $account_logged->getCustomField("created"); $account_email = $account_logged->getEMail(); $account_email_new_time = $account_logged->getCustomField("email_new_time"); if($account_email_new_time > 1) $account_email_new = $account_logged->getCustomField("email_new"); $account_rlname = $account_logged->getRLName(); $account_location = $account_logged->getLocation(); if($account_logged->isBanned()) if($account_logged->getBanTime() > 0) $welcome_msg = 'Your account is banished until '.date("j F Y, G:i:s", $account_logged->getBanTime()).'!'; else $welcome_msg = 'Your account is banished FOREVER!'; else $welcome_msg = 'Welcome to your account!'; echo '

'.$welcome_msg.'

'; //if account dont have recovery key show hint if(empty($account_reckey)) echo '
Hint:You can register your account for increased protection. Click on "Register Account" and get your free recovery key today!

'; $account_email_change = ''; if($account_email_new_time > 1) { if($account_email_new_time < time()) $account_email_change = '
(You can accept '.$account_email_new.' as a new email.)'; else { $account_email_change = '
You can accept new e-mail after '.date("j F Y", $account_email_new_time)."."; echo '
Note:A request has been submitted to change the email address of this account to '.$account_email_new.'. After '.date("j F Y, G:i:s", $account_email_new_time).' you can accept the new email address and finish the process. Please cancel the request if you do not want your email address to be changed! Also cancel the request if you have no access to the new email address!


'; } } echo '
General Information
Email Address:'.$account_email.''.$account_email_change.'
Created:'.date("j F Y, G:i:s", $account_created).'
Last Login:'.date("j F Y, G:i:s", time()).'
Account Status:'.$account_status.'
Registred:'.$account_registred.'
'; //show button "register account" if(empty($account_reckey)) echo ''; echo '

Public Information
Real Name:'.$account_rlname.'
Location:'.$account_location.'
'; echo '
Account logs
'; $player_number_counter = 0; foreach($account_logged->getActionsLog(0, 1000) as $action) { echo ''; } echo '
ActionDateIP
'.$action['action'] . '' . date("jS F Y H:i:s",$action['date']) . ' ' . long2ip($action['ip']) . '

'; echo '
Characters
'; $account_players = $account_logged->getPlayersList(); $account_players->orderBy('id'); //show list of players on account $player_number_counter = 0; foreach($account_players as $account_player) { echo ''; if(!$account_player->isOnline()) echo ''; else echo ''; echo ''; } echo '
NameLevelStatus 
'.$player_number_counter.'. '.$account_player->getName(); if($account_player->isDeleted()) echo ' [ DELETED ] '; echo ''.$account_player->getLevel().' '.$config['vocations'][$account_player->getVocation()].'OfflineOnline[Edit]


'; } //########### CHANGE PASSWORD ########## if($action == "changepassword") { $new_password = isset($_POST['newpassword']) ? $_POST['newpassword'] : NULL; $new_password2 = isset($_POST['newpassword2']) ? $_POST['newpassword2'] : NULL; $old_password = isset($_POST['oldpassword']) ? $_POST['oldpassword'] : NULL; if(empty($new_password) && empty($new_password2) && empty($old_password)) { echo 'Please enter your current password and a new password. For your security, please enter the new password twice.

Change Password
New Password:
New Password Again:
Current Password:

'; } else { if(empty($new_password) || empty($new_password2) || empty($old_password)){ $show_msgs[] = "Please fill in form."; } if($new_password != $new_password2) { $show_msgs[] = "The new passwords do not match!"; } if(empty($show_msgs)) { if(!check_password($new_password)) { $show_msgs[] = "New password contains illegal chars (a-z, A-Z and 0-9 only!). Minimum password length is 7 characters and maximum 32."; } $old_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $old_password); if($old_password != $account_logged->getPassword()) { $show_msgs[] = "Current password is incorrect!"; } } if(!empty($show_msgs)){ //show errors echo '
The Following Errors Have Occurred:
'; foreach($show_msgs as $show_msg) { echo '
  • '.$show_msg; } echo '

  • '; //show form echo 'Please enter your current password and a new password. For your security, please enter the new password twice.

    Change Password
    New Password:
    New Password Again:
    Current Password:

    '; } else { $org_pass = $new_password; if($config_salt_enabled) { $salt = generateRandomString(10, false, true, true); $new_password = $salt . $new_password; $account_logged->setSalt($salt); } $new_password = encrypt($new_password); $account_logged->setPassword($new_password); $account_logged->save(); $account_logged->logAction('Account password changed.'); echo '
    Password Changed
    Your password has been changed.'; if($config['mail_enabled'] && $config['send_mail_when_change_password']) { $mailBody = '

    Password to account changed!

    You or someone else changed password to your account on server '.$config['lua']['serverName'].'.

    New password: '.$org_pass.'

    '; if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - Changed password", $mailBody)) echo '
    Your new password were send on email address '.$account_logged->getEMail().'.'; else echo '

    An error occorred while sending email with password:
    ' . $mailer->ErrorInfo . '

    '; } echo '

    '; $_SESSION['password'] = $new_password; } } } //############# CHANGE E-MAIL ################### if($action == "changeemail") { $account_email_new_time = $account_logged->getCustomField("email_new_time"); if($account_email_new_time > 10) {$account_email_new = $account_logged->getCustomField("email_new"); } if($account_email_new_time < 10){ if(isset($_POST['changeemailsave']) && $_POST['changeemailsave'] == 1) { $account_email_new = $_POST['new_email']; $post_password = $_POST['password']; if(empty($account_email_new)) { $change_email_errors[] = "Please enter your new email address."; } else { if(!check_mail($account_email_new)) { $change_email_errors[] = "E-mail address is not correct."; } } if(empty($post_password)) { $change_email_errors[] = "Please enter password to your account."; } else { $post_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $post_password); if($post_password != $account_logged->getPassword()) { $change_email_errors[] = "Wrong password to account."; } } if(empty($change_email_errors)) { $account_email_new_time = time() + $config['account_mail_change'] * 24 * 3600; $account_logged->setCustomField("email_new", $account_email_new); $account_logged->setCustomField("email_new_time", $account_email_new_time); echo '
    New Email Address Requested
    You have requested to change your email address to '.$account_email_new.'. The actual change will take place after '.date("j F Y, G:i:s", $account_email_new_time).', during which you can cancel the request at any time.

    '; } else { //show errors echo '
    The Following Errors Have Occurred:
    '; foreach($change_email_errors as $change_email_error) { echo '
  • '.$change_email_error; } echo '

  • '; //show form echo 'Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. For security reasons, the actual change will be finalised after a waiting period of '.$config['account_mail_change'].' days.

    Change Email Address
    New Email Address:
    Password:

    '; } } else { echo 'Please enter your password and the new email address. Make sure that you enter a valid email address which you have access to. For security reasons, the actual change will be finalised after a waiting period of '.$config['account_mail_change'].' days.

    Change Email Address
    New Email Address:
    Password:

    '; } } else { if($account_email_new_time < time()) { if($_POST['changeemailsave'] == 1) { $account_logged->setCustomField("email_new", ""); $account_logged->setCustomField("email_new_time", 0); $account_logged->setEmail($account_email_new); $account_logged->save(); $account_logged->logAction('Account email changed to ' . $account_email_new . ''); echo '
    Email Address Change Accepted
    You have accepted '.$account_logged->getEmail().' as your new email adress.

    '; } else { echo '
    Email Address Change Accepted
    Do you accept '.$account_email_new.' as your new email adress?

     
     
    '; } } else { echo '
    Change of Email Address
    A request has been submitted to change the email address of this account to '.$account_email_new.'.
    The actual change will take place on '.date("j F Y, G:i:s", $account_email_new_time).'.
    If you do not want to change your email address, please click on "Cancel".

    '; } } if(isset($_POST['emailchangecancel']) && $_POST['emailchangecancel'] == 1) { $account_logged->setCustomField("email_new", ""); $account_logged->setCustomField("email_new_time", 0); echo '
    Email Address Change Cancelled
    Your request to change the email address of your account has been cancelled. The email address will not be changed.

    '; } } //########### CHANGE PUBLIC INFORMATION (about account owner) ###################### if($action == "changeinfo") { $new_rlname = isset($_POST['info_rlname']) ? htmlspecialchars(stripslashes($_POST['info_rlname'])) : NULL; $new_location = isset($_POST['info_location']) ? htmlspecialchars(stripslashes($_POST['info_location'])) : NULL; $new_country = isset($_POST['info_country']) ? htmlspecialchars(stripslashes($_POST['info_country'])) : NULL; if(isset($_POST['changeinfosave']) && $_POST['changeinfosave'] == 1) { //save data from form $account_logged->setCustomField("rlname", $new_rlname); $account_logged->setCustomField("location", $new_location); $account_logged->setCustomField("country", $new_country); $account_logged->logAction('Changed Real Name to ' . $new_rlname . ', Location to ' . $new_location . ' and Country to ' . $config['countries'][$new_country] . '.'); echo '
    Public Information Changed
    Your public information has been changed.

    '; } else { //show form $account_rlname = $account_logged->getCustomField("rlname"); $account_location = $account_logged->getCustomField("location"); if($config['account_country']) $account_country = $account_logged->getCustomField("country"); ?> Here you can tell other players about yourself. This information will be displayed alongside the data of your characters. If you do not want to fill in a certain field, just leave it blank.

    Change Public Information
    Real Name:
    Location:
    Country:

    getCustomField('salt') : '') . $_POST['reg_password']); $old_key = $account_logged->getCustomField("key"); if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == "1") { if($reg_password == $account_logged->getPassword()) { if(empty($old_key)) { $dontshowtableagain = true; $new_rec_key = generateRandomString(10, false, true, true); $account_logged->setCustomField("key", $new_rec_key); $account_logged->logAction('Generated recovery key.'); echo '
    Account Registered
    Thank you for registering your account! You can now recover your account if you have lost access to the assigned email address by using the following

       Recovery Key: '.$new_rec_key.'


    Important:
    • Write down this recovery key carefully.
    • Store it at a safe place!
    • '; if($config['mail_enabled'] && $config['send_mail_when_generate_reckey']) { $mailBody = '

      New recovery key!

      You or someone else generated recovery key to your account on server '.$config['lua']['serverName'].'.

      Recovery key: '.$new_rec_key.'

      '; if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - recovery key", $mailBody)) echo '
      Your recovery key were send on email address '.$account_logged->getEMail().'.'; else echo '

      An error occorred while sending email with recovery key! You will not receive e-mail with this key. Error:
      ' . $mailer->ErrorInfo . '

      '; } echo '

    '; } else $reg_errors[] = 'Your account is already registred.'; } else $reg_errors[] = 'Wrong password to account.'; } if(!$dontshowtableagain) { //show errors if not empty if(!empty($reg_errors)) { echo '
    The Following Errors Have Occurred:
    '; foreach($reg_errors as $reg_error) echo '
  • '.$reg_error . '
  • '; echo '

    '; } //show form echo 'To generate recovery key for your account please enter your password.

    Generate recovery key
    Password:

    '; } } //############## GENERATE NEW RECOVERY KEY ########### if($action == "newreckey") { if(isset($_POST['reg_password'])) $reg_password = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $_POST['reg_password']); $reckey = $account_logged->getCustomField('key'); if((!$config['generate_new_reckey'] || !$config['mail_enabled']) || empty($reckey)) echo 'You cant get new rec key'; else { $points = $account_logged->getCustomField('premium_points'); if(isset($_POST['registeraccountsave']) && $_POST['registeraccountsave'] == '1') { if($reg_password == $account_logged->getPassword()) { if($points >= $config['generate_new_reckey_price']) { $dontshowtableagain = true; $new_rec_key = generateRandomString(10, false, true, true); echo '
    Account Registered
      '; $mailBody = '

      New recovery key!

      You or someone else generated recovery key to your account on server '.$config['lua']['serverName'].'.

      Recovery key: '.$new_rec_key.'

      '; if(_mail($account_logged->getEMail(), $config['lua']['serverName']." - new recovery key", $mailBody)) { $account_logged->setCustomField("key", $new_rec_key); $account_logged->setCustomField("premium_points", $account_logged->getCustomField("premium_points") - $config['generate_new_reckey_price']); $account_logged->logAction('Generated new recovery key for ' . $config['generate_new_reckey_price'] . ' premium points.'); echo '
      Your recovery key were send on email address '.$account_logged->getEMail().' for '.$config['generate_new_reckey_price'].' premium points.'; } else echo '

      An error occorred while sending email ( '.$account_logged->getEMail().' ) with recovery key! Recovery key not changed. Try again. Error:
      ' . $mailer->ErrorInfo . '

      '; echo '

    '; } else $reg_errors[] = 'You need '.$config['generate_new_reckey_price'].' premium points to generate new recovery key. You have '.$points.' premium points.'; } else $reg_errors[] = 'Wrong password to account.'; } if(!$dontshowtableagain) { //show errors if not empty if(!empty($reg_errors)) { echo '
    The Following Errors Have Occurred:
    '; foreach($reg_errors as $reg_error) echo '
  • '.$reg_error; echo '

  • '; } //show form echo 'To generate NEW recovery key for your account please enter your password.
    New recovery key cost '.$config['generate_new_reckey_price'].' Premium Points. You have '.$points.' premium points. You will receive e-mail with this recovery key.
    Generate recovery key
    Password:

    '; } } } //###### CHANGE CHARACTER COMMENT ###### if($action == "changecomment") { $player_name = stripslashes($_REQUEST['name']); $new_comment = isset($_POST['comment']) ? htmlspecialchars(stripslashes(substr($_POST['comment'],0,2000))) : NULL; $new_hideacc = isset($_POST['accountvisible']) ? (int)$_POST['accountvisible'] : NULL; if(check_name($player_name)) { $player = $ots->createObject('Player'); $player->find($player_name); if($player->isLoaded()) { $player_account = $player->getAccount(); if($account_logged->getId() == $player_account->getId()) { if(isset($_POST['changecommentsave']) && $_POST['changecommentsave'] == 1) { $player->setCustomField("hidden", $new_hideacc); $player->setCustomField("comment", $new_comment); $account_logged->logAction('Changed comment for character ' . $player->getName() . '.'); echo '
    Character Information Changed
    The character information has been changed.

    '; } else { echo 'Here you can see and edit the information about your character.
    If you do not want to specify a certain field, just leave it blank.

    Edit Character Information
    Name:'.$player_name.'
    Hide Account:'; if($player->getCustomField("hidden") == 1) { echo ''; } else { echo ''; } echo ' check to hide your account information'; if((int)$player->getCustomField('group_id') > 1) echo ' (you will be also hidden on the Team page!)'; echo '
    Comment:
    [max. length: 2000 chars, 50 lines (ENTERs)]

    '; } } else { echo "Error. Character ".$player_name." is not on your account."; } } else { echo "Error. Character with this name doesn't exist."; } } else { echo "Error. Name contain illegal characters."; } } //### DELETE character from account ### if($action == "deletecharacter") { $player_name = isset($_POST['delete_name']) ? stripslashes($_POST['delete_name']) : NULL; $password_verify = isset($_POST['delete_password']) ? $_POST['delete_password'] : NULL; $password_verify = encrypt(($config_salt_enabled ? $account_logged->getCustomField('salt') : '') . $password_verify); if(isset($_POST['deletecharactersave']) && $_POST['deletecharactersave'] == 1) { if(!empty($player_name) && !empty($password_verify)) { if(check_name($player_name)) { $player = $ots->createObject('Player'); $player->find($player_name); if($player->isLoaded()) { $player_account = $player->getAccount(); if($account_logged->getId() == $player_account->getId()) { if($password_verify == $account_logged->getPassword()) { if(!$player->isOnline()) { //dont show table "delete character" again $dontshowtableagain = true; //delete player if(fieldExist('deletion', 'players')) $player->setCustomField('deletion', 1); else $player->setCustomField('deleted', 1); $account_logged->logAction('Deleted character ' . $player->getName() . '.'); echo '
    Character Deleted
    The character '.$player_name.' has been deleted.

    '; } else $delete_errors[] = 'This character is online.'; } else { $delete_errors[] = 'Wrong password to account.'; } } else { $delete_errors[] = 'Character '.$player_name.' is not on your account.'; } } else { $delete_errors[] = 'Character with this name doesn\'t exist.'; } } else { $delete_errors[] = 'Name contain illegal characters.'; } } else { $delete_errors[] = 'Character name or/and password is empty. Please fill in form.'; } } if(!$dontshowtableagain) { if(!empty($delete_errors)) { echo '
    The Following Errors Have Occurred:
    '; foreach($delete_errors as $delete_error) { echo '
  • '.$delete_error; } echo '

  • '; } echo 'To delete a character enter the name of the character and your password.

    Delete Character
    Character Name:
    Password:

    '; } } //## CREATE CHARACTER on account ### if($action == "createcharacter") { echo ''; $newchar_name = isset($_POST['newcharname']) ? stripslashes(ucwords(strtolower($_POST['newcharname']))) : NULL; $newchar_sex = isset($_POST['newcharsex']) ? $_POST['newcharsex'] : NULL; $newchar_vocation = isset($_POST['newcharvocation']) ? $_POST['newcharvocation'] : NULL; $newchar_town = isset($_POST['newchartown']) ? $_POST['newchartown'] : NULL; $newchar_errors = array(); $newchar_created = false; if(isset($_POST['savecharacter']) && $_POST['savecharacter'] == 1) { if(empty($newchar_name)) $newchar_errors[] = 'Please enter a name for your character!'; if(strlen($newchar_name) > 25) $newchar_errors[] = 'Name is too long. Max. lenght 25 letters.'; else if(strlen($newchar_name) < 3) $newchar_errors[] = 'Name is too short. Min. lenght 25 letters.'; if(empty($newchar_sex) && $newchar_sex != "0") $newchar_errors[] = 'Please select the sex for your character!'; if(count($config['character_samples']) > 1) { if(!isset($newchar_vocation)) $newchar_errors[] = 'Please select a vocation for your character.'; } else $newchar_vocation = $config['character_samples'][0]; if(count($config['character_towns']) > 1) { if(empty($newchar_town)) $newchar_errors[] = 'Please select a town for your character.'; } else $newchar_town = $config['character_towns'][0]; //check if was namelocked previously if(tableExist('player_namelocks') && fieldExist('name', 'player_namelocks')) { $namelockSQL = $db->query('SELECT `player_id` FROM `player_namelocks` WHERE `name` = ' . $db->quote($newchar_name)); if($namelockSQL->rowCount() > 0) $newchar_errors[] = 'Character with this name has been namelocked.'; } if(empty($newchar_errors)) { $error = ''; if(!check_name_new_char($newchar_name, $error)) $newchar_errors[] = $error; if($newchar_sex != 1 && $newchar_sex != "0") $newchar_errors[] = 'Sex must be equal 0 (female) or 1 (male).'; if(!in_array($newchar_town, $config['character_towns'])) $newchar_errors[] = 'Please select valid town.'; if(count($config['character_samples']) > 1) { $newchar_vocation_check = false; foreach($config['character_samples'] as $char_vocation_key => $sample_char) if($newchar_vocation == $char_vocation_key) $newchar_vocation_check = true; if(!$newchar_vocation_check) $newchar_errors[] = 'Unknown vocation. Please fill in form again.'; } else $newchar_vocation = 0; } if(empty($newchar_errors)) { $check_name_in_database = $ots->createObject('Player'); $check_name_in_database->find($newchar_name); if($check_name_in_database->isLoaded()) $newchar_errors[] .= 'This name is already used. Please choose another name!'; $number_of_players_on_account = $account_logged->getPlayersList()->count(); if($number_of_players_on_account >= $config['characters_per_account']) $newchar_errors[] .= 'You have too many characters on your account ('.$number_of_players_on_account.'/'.$config['characters_per_account'].')!'; } if(empty($newchar_errors)) { $char_to_copy_name = $config['character_samples'][$newchar_vocation]; $char_to_copy = new OTS_Player(); $char_to_copy->find($char_to_copy_name); if(!$char_to_copy->isLoaded()) $newchar_errors[] .= 'Wrong characters configuration. Try again or contact with admin. ADMIN: Edit file config/config.php and set valid characters to copy names. Character to copy'.$char_to_copy_name.'
    doesn\'t exist.'; } if(empty($newchar_errors)) { if($newchar_sex == "0") $char_to_copy->setLookType(136); $player = $ots->createObject('Player'); $player->setName($newchar_name); $player->setAccount($account_logged); //$player->setGroupId($char_to_copy->getGroup()->getId()); $player->setGroupId(1); $player->setSex($newchar_sex); $player->setVocation($char_to_copy->getVocation()); if(fieldExist('promotion', 'players')) $player->setPromotion($char_to_copy->getPromotion()); if(fieldExist('direction', 'players')) $player->setDirection($char_to_copy->getDirection()); $player->setConditions($char_to_copy->getConditions()); $rank = $char_to_copy->getRank(); if($rank->isLoaded()) { $player->setRank($char_to_copy->getRank()); } if(fieldExist('lookaddons', 'players')) $player->setLookAddons($char_to_copy->getLookAddons()); $player->setTownId($newchar_town); $player->setExperience($char_to_copy->getExperience()); $player->setLevel($char_to_copy->getLevel()); $player->setMagLevel($char_to_copy->getMagLevel()); $player->setHealth($char_to_copy->getHealth()); $player->setHealthMax($char_to_copy->getHealthMax()); $player->setMana($char_to_copy->getMana()); $player->setManaMax($char_to_copy->getManaMax()); $player->setManaSpent($char_to_copy->getManaSpent()); $player->setSoul($char_to_copy->getSoul()); $player->setLookBody($char_to_copy->getLookBody()); $player->setLookFeet($char_to_copy->getLookFeet()); $player->setLookHead($char_to_copy->getLookHead()); $player->setLookLegs($char_to_copy->getLookLegs()); $player->setLookType($char_to_copy->getLookType()); $player->setCap($char_to_copy->getCap()); $player->setBalance(0); $player->setPosX(0); $player->setPosY(0); $player->setPosZ(0); $player->setStamina($config['otserv_version'] == TFS_03 ? 151200000 : 2520); if(fieldExist('loss_experience', 'players')) { $player->setLossExperience($char_to_copy->getLossExperience()); $player->setLossMana($char_to_copy->getLossMana()); $player->setLossSkills($char_to_copy->getLossSkills()); } if(fieldExist('loss_items', 'players')) { $player->setLossItems($char_to_copy->getLossItems()); $player->setLossContainerse($char_to_copy->getLossContainers()); } $player->save(); $player->setCustomField("created", time()); $newchar_created = true; $account_logged->logAction('Created character ' . $player->getName() . '.'); unset($player); $player = $ots->createObject('Player'); $player->find($newchar_name); if($player->isLoaded()) { if(tableExist('player_skills')) { for($i=0;$i<7;$i++) { $skillExists = $db->query('SELECT `skillid` FROM `player_skills` WHERE `player_id` = ' . $player->getId() . ' AND `skillid` = ' . $i); if($skillExists->rowCount() <= 0) { $db->query('INSERT INTO `player_skills` (`player_id`, `skillid`, `value`, `count`) VALUES ('.$player->getId().', '.$i.', 10, 0)'); } } } $loaded_items_to_copy = $db->query("SELECT * FROM player_items WHERE player_id = ".$char_to_copy->getId().""); foreach($loaded_items_to_copy as $save_item) $db->query("INSERT INTO `player_items` (`player_id` ,`pid` ,`sid` ,`itemtype`, `count`, `attributes`) VALUES ('".$player->getId()."', '".$save_item['pid']."', '".$save_item['sid']."', '".$save_item['itemtype']."', '".$save_item['count']."', '".$save_item['attributes']."');"); echo '
    Character Created
    The character '.$newchar_name.' has been created.
    Please select the outfit when you log in for the first time.

    See you on '.$config['lua']['serverName'].'!

    '; } else { echo "Error. Can\'t create character. Probably problem with database. Try again or contact with admin."; exit; } } } if(count($newchar_errors) > 0) { echo '
    '; echo 'The Following Errors Have Occurred:
    '; foreach($newchar_errors as $newchar_error) echo '
  • '.$newchar_error . '
  • '; echo '

    '; } if(!$newchar_created) { echo 'Please choose a name'; if(count($config['character_samples']) > 1) echo ', vocation'; echo ' and sex for your character.
    In any case the name must not violate the naming conventions stated in the '.$config['lua']['serverName'].' Rules, or your character might get deleted or name locked.'; if($account_logged->getPlayersList()->count() >= $config['characters_per_account']) { echo ' You have maximum number of characters per account on your account. Delete one before you make new.'; } echo '

    Create Character
    NameSex

    Please enter your character name.
    '; echo '
    '; echo '
    '; echo '
    '; if(count($config['character_samples']) > 1) { echo '

    Select your vocation:
    '; foreach($config['character_samples'] as $char_vocation_key => $sample_char) { echo ''; } echo '
    '; } if(count($config['character_towns']) > 1) { echo '

    Select your city:
    '; foreach($config['character_towns'] as $town_id) { echo ''; } echo '
    '; } else echo '
    '; echo '
    '; } } ?>