Logout Successful
You have logged out of your '.$config['server']['serverName'].' account. In order to view your account you need to log in again.
'; else $main_content .= 'Please enter here your account number and password or create an account.

Account number:
Password:

'; else { //########### ACCOUNT MANAGER ########## if($action == "") { $account_reckey = $account_logged->getRecoveryKey(); $history_pacc = $SQL->query('SELECT * FROM '.$SQL->tableName('z_shop_history_pacc').' WHERE to_account = '.$SQL->quote($account_logged->getId()).''); if(empty($account_reckey)) $account_registred = 'No'; else if($config['site']['generate_new_reckey'] && $config['site']['send_emails']) $account_registred = 'Yes'; else $account_registred = 'Yes'; $account_created = $account_logged->getCreated(); $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(); $welcome_msg = 'Welcome in your account!'; $main_content .= '
'; $main_content .= '[General information] '; if(count($history_pacc) < 0) $main_content .= '[Billing Information] '; $main_content .= '[Characters] '; $main_content .= '

'.$welcome_msg.'

'; //if account dont have recovery key show hint if(empty($account_reckey)) $main_content .= '
Sign:
Take care of your account and register it for more safety!

'; 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)."."; $main_content .= '
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!


'; } $main_content .= '
General information
Account number:'.$account_logged->getCustomField("id").'
Email:'.$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()).'
Registered:'.$account_registred.'
'; //show button "register account" if(empty($account_reckey)) $main_content .= ''; $main_content .= '

Public information
Real name:'.$account_rlname.'
Location:'.$account_location.'


'; if(count($history_pacc) < 0) { $main_content .= '
Billing Information
Buy premium time to benefit from all premium features.
'; $counter = 0; foreach($history_pacc as $pacc) { if(is_int($counter / 2)) $bgcolor = $config['site']['lightborder']; else $bgcolor = $config['site']['darkborder']; $counter++; $main_content .= ''; } $main_content .= '
DateDescriptionDaysStartEnd
'.date("M j Y", $pacc['trans_start']).'Premium Surprise ('.$pacc['pacc_days'].' days)'.$pacc['pacc_days'].''.date("M j Y", $pacc['trans_start']).''.date("M j Y", $pacc['trans_real']).'


'; } $main_content .= '
Characters
'; $account_players = $account_logged->getPlayersList(); $account_players->orderBy('name'); //show list of players on account foreach($account_players as $account_player) { $player_number_counter++; $main_content .= ''; if(!$account_player->isPremium()) $main_content .= ''; else $main_content .= ''; if(!$account_player->isOnline()) $main_content .= ''; else $main_content .= ''; $main_content .= ''; } $main_content .= '
NameLevel
Type
Status 
'.$player_number_counter.'. '.$account_player->getName(); if($account_player->isDeleted()) $main_content .= ' [ DELETED ] >> UNDELETE <<'; $main_content .= ''.$account_player->getLevel().'nonepremmyOfflineOnline[Edit]


'; } //########### CHANGE PASSWORD ########## if($action == "changepassword") { $new_password = trim($_POST['newpassword']); $new_password2 = trim($_POST['newpassword2']); $old_password = trim($_POST['oldpassword']); if(empty($new_password) && empty($new_password2) && empty($old_password)) $main_content .= '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!) or lenght."; $old_password = $old_password; if($old_password != $account_logged->getPassword()) $show_msgs[] = "Current password is incorrect!"; } if(!empty($show_msgs)) { //show errors $main_content .= '
The Following Errors Have Occurred:
'; foreach($show_msgs as $show_msg) $main_content .= '
  • '.$show_msg; $main_content .= '

  • '; //show form $main_content .= 'Wpisz aktualne hasĹ‚o oraz nowe hasĹ‚o. Dla twojego bezpieczeĹ„stwa, wpisz dwa razy nowe hasĹ‚o.

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

    '; } else { $org_pass = $new_password; $new_password = $new_password; $account_logged->setPassword($new_password); $account_logged->save(); $main_content .= '
    Password Changed
    Your password has been changed.'; if($config['site']['send_emails'] && $config['site']['send_mail_when_change_password']) { $mailBody = '

    Password to account changed!

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

    New password: '.$org_pass.'

    '; require("phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); if ($config['site']['smtp_enabled'] == "yes") { $mail->IsSMTP(); $mail->Host = $config['site']['smtp_host']; $mail->Port = (int)$config['site']['smtp_port']; $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false); $mail->Username = $config['site']['smtp_user']; $mail->Password = $config['site']['smtp_pass']; } else $mail->IsMail(); $mail->IsHTML(true); $mail->From = $config['site']['mail_address']; $mail->AddAddress($account_logged->getEMail()); $mail->Subject = $config['server']['serverName']." - Changed password"; $mail->Body = $mailBody; if($mail->Send()) $main_content .= '
    Your new password were send on email address '.$account_logged->getEMail().'.'; else $main_content .= '
    An error occorred while sending email with password!'; } $main_content .= '

    '; $_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($_POST['changeemailsave'] == 1) { $account_email_new = trim($_POST['new_email']); $post_password = trim($_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 = $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['site']['email_days_to_change'] * 24 * 3600; $account_logged->setCustomField("email_new", $account_email_new); $account_logged->setCustomField("email_new_time", $account_email_new_time); $main_content .= '
    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 $main_content .= '
    The Following Errors Have Occurred:
    '; foreach($change_email_errors as $change_email_error) $main_content .= '
  • '.$change_email_error; $main_content .= '

  • '; //show form $main_content .= '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['site']['email_days_to_change'].' days.

    Change Email Address
    New Email Address:
    Password:

    '; } } else $main_content .= '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['site']['email_days_to_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(); $main_content .= '
    Email Address Change Accepted
    You have accepted '.$account_logged->getEmail().' as your new email adress.

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

     
     
    '; } else $main_content .= '
    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($_POST['emailchangecancel'] == 1) { $account_logged->setCustomField("email_new", ""); $account_logged->setCustomField("email_new_time", 0); $main_content = '
    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 = htmlspecialchars(stripslashes(trim($_POST['info_rlname']))); $new_location = htmlspecialchars(stripslashes(trim($_POST['info_location']))); if($_POST['changeinfosave'] == 1) { //save data from form $account_logged->setRLName($new_rlname); $account_logged->setLocation($new_location); $account_logged->save(); $main_content .= '
    Public Information Changed
    Your public information has been changed.

    '; } else { //show form $account_rlname = $account_logged->getRLName(); $account_location = $account_logged->getLocation(); $main_content .= '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:

    '; } } //############## GENERATE RECOVERY KEY ########### if($action == "registeraccount") { $reg_password = trim($_POST['reg_password']); $old_key = $account_logged->getRecoveryKey("rkey"); if($_POST['registeraccountsave'] == "1") { if($reg_password == $account_logged->getPassword()) { if(empty($old_key)) { $dontshowtableagain = 1; $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789'; $max = strlen($acceptedChars)-1; $new_rec_key = NULL; // 10 = number of chars in generated key for($i=0; $i < 10; $i++) { $cnum[$i] = $acceptedChars{mt_rand(0, $max)}; $new_rec_key .= $cnum[$i]; } $account_logged->setRecoveryKey($new_rec_key); $account_logged->save(); $main_content .= '
    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['site']['send_emails'] && $config['site']['send_mail_when_generate_reckey']) { $mailBody = '

      New recovery key!

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

      Recovery key: '.$new_rec_key.'

      '; require("phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); if ($config['site']['smtp_enabled'] == "yes") { $mail->IsSMTP(); $mail->Host = $config['site']['smtp_host']; $mail->Port = (int)$config['site']['smtp_port']; $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false); $mail->Username = $config['site']['smtp_user']; $mail->Password = $config['site']['smtp_pass']; } else $mail->IsMail(); $mail->IsHTML(true); $mail->From = $config['site']['mail_address']; $mail->AddAddress($account_logged->getEMail()); $mail->Subject = $config['server']['serverName']." - recovery key"; $mail->Body = $mailBody; if($mail->Send()) $main_content .= '
      Your recovery key were send on email address '.$account_logged->getEMail().'.'; else $main_content .= '
      An error occorred while sending email with recovery key! You will not receive e-mail with this key.'; } $main_content .= '

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

  • '; } //show form $main_content .= 'To generate recovery key for your account please enter your password.

    Generate recovery key
    Password:

    '; } } //############## GENERATE NEW RECOVERY KEY ########### if($action == "newreckey") { $reg_password = trim($_POST['reg_password']); $reckey = $account_logged->getRecoveryKey(); if((!$config['site']['generate_new_reckey'] || !$config['site']['send_emails']) || empty($reckey)) $main_content .= 'You cant get new rec key'; else { $points = $account_logged->getPremiumPoints(); if($_POST['registeraccountsave'] == "1") { if($reg_password == $account_logged->getPassword()) { if($points >= $config['site']['generate_new_reckey_price']) { $dontshowtableagain = 1; $acceptedChars = 'ABCDEFGHIJKLMNPQRSTUVWXYZ123456789'; $max = strlen($acceptedChars)-1; $new_rec_key = NULL; // 10 = number of chars in generated key for($i=0; $i < 10; $i++) { $cnum[$i] = $acceptedChars{mt_rand(0, $max)}; $new_rec_key .= $cnum[$i]; } $main_content .= '
    Account Registered
      '; $mailBody = '

      New recovery key!

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

      Recovery key: '.$new_rec_key.'

      '; require("phpmailer/class.phpmailer.php"); $mail = new PHPMailer(); if ($config['site']['smtp_enabled'] == "yes") { $mail->IsSMTP(); $mail->Host = $config['site']['smtp_host']; $mail->Port = (int)$config['site']['smtp_port']; $mail->SMTPAuth = ($config['site']['smtp_auth'] ? true : false); $mail->Username = $config['site']['smtp_user']; $mail->Password = $config['site']['smtp_pass']; } else $mail->IsMail(); $mail->IsHTML(true); $mail->From = $config['site']['mail_address']; $mail->AddAddress($account_logged->getEMail()); $mail->Subject = $config['server']['serverName']." - new recovery key"; $mail->Body = $mailBody; if($mail->Send()) { $account_logged->setRecoveryKey(new_rec_key); $account_logged->save(); $main_content .= '
      Your recovery key were send on email address '.$account_logged->getEMail().' for '.$config['site']['generate_new_reckey_price'].' premium points.'; } else $main_content .= '
      An error occorred while sending email ( '.$account_logged->getEMail().' ) with recovery key! Recovery key not changed. Try again.'; $main_content .= '

    '; } else $reg_errors[] = 'You need '.$config['site']['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 != 1) { //show errors if not empty if(!empty($reg_errors)) { $main_content .= '
    The Following Errors Have Occurred:
    '; foreach($reg_errors as $reg_error) $main_content .= '
  • '.$reg_error; $main_content .= '

  • '; } //show form $main_content .= 'To generate NEW recovery key for your account please enter your password.
    New recovery key cost '.$config['site']['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 = htmlspecialchars(stripslashes(substr(trim($_POST['comment']),0,2000))); $new_hideacc = (int) $_POST['accountvisible']; 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($_POST['changecommentsave'] == 1) { $player->setCustomField("hide_char", $new_hideacc); $player->setCustomField("komentarz", $new_comment); $main_content .= '
    Character Information Changed
    The character information has been changed.

    '; } else { $main_content .= '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->getHideChar() == 1) $main_content .= ''; else $main_content .= ''; $main_content .= ' check to hide your account information
    Comment:
    [max. length: 2000 chars, 50 lines]

    '; } } else $main_content .= "Error. Character ".$player_name." is not on your account."; } else $main_content .= "Error. Character with this name doesn't exist."; } else $main_content .= "Error. Name contain illegal characters."; } //## CREATE CHARACTER on account ### if($action == "createcharacter") { $main_content .= ''; $newchar_name = stripslashes(ucwords(strtolower(trim($_POST['newcharname'])))); $newchar_sex = $_POST['newcharsex']; $newchar_vocation = $_POST['newcharvocation']; if($_POST['savecharacter'] != 1) { $main_content .= 'Please choose a name'; $main_content .= ', vocation'; $main_content .= ' and sex for your character.
    In any case the name must not violate the naming conventions stated in the '.$config['server']['serverName'].' Rules, or your character might get deleted or name locked.'; if($account_logged->getPlayersList()->count() >= $config['site']['max_players_per_account']) $main_content .= ' You have maximum number of characters per account on your account. Delete one before you make new.'; $main_content .= '

    Create Character
    '; $main_content .= '
    '; } $main_content .= '
    NameSex

    Please enter your character name.
    '; $main_content .= ' $sample_char) { $main_content .= '
    '; $main_content .= '
    '; } else { if(strlen($newchar_name > 20)) $newchar_errors[] = 'Character name can not be logner then 20 characters.'; if(empty($newchar_name)) $newchar_errors[] = 'Please enter a name for your character!'; if(empty($newchar_sex) && $newchar_sex != "0") $newchar_errors[] = 'Please select the sex for your character!'; if(empty($newchar_vocation) && $newchar_vocation = "0") $newchar_errors[] = 'Please select a vocation for your character.'; if(strpos($newchar_name, 'Administrator') !== false) $newchar_errors[] = 'This character name is forbidden.'; if(empty($newchar_errors)) { if(!check_name_new_char($newchar_name)) $newchar_errors[] = 'This name contains invalid letters, words or format. Please use only a-Z, - , \' and space.'; if($newchar_sex != 1 && $newchar_sex != "0") $newchar_errors[] = 'Sex must be equal 0 (female) or 1 (male).'; $newchar_vocation_check = FALSE; foreach($config['site']['newchar_vocations'] 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.'; } 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['site']['max_players_per_account']) $newchar_errors[] .= 'You have too many characters on your account ('.$number_of_players_on_account.'/'.$config['site']['max_players_per_account'].')!'; } if(empty($newchar_errors)) { $char_to_copy_name = $config['site']['newchar_vocations'][$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->setGroup($char_to_copy->getGroup()); $player->setSex($newchar_sex); $player->setVocation($char_to_copy->getVocation()); $player->setRank($char_to_copy->getRank()); $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->setDirection($char_to_copy->getDirection()); $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->setPosX(160); $player->setPosY(544); $player->setPosZ(7); $player->setPremium(3); // 3 godziny $player->save(); unset($player); $player = $ots->createObject('Player'); $player->find($newchar_name); if($player->isLoaded()) { $player->setSkill(0,$char_to_copy->getSkill(0)); $player->setSkill(1,$char_to_copy->getSkill(1)); $player->setSkill(2,$char_to_copy->getSkill(2)); $player->setSkill(3,$char_to_copy->getSkill(3)); $player->setSkill(4,$char_to_copy->getSkill(4)); $player->setSkill(5,$char_to_copy->getSkill(5)); $player->setSkill(6,$char_to_copy->getSkill(6)); $SQL->query("INSERT INTO `player_items` (`player_id`, `slot`, `sid`, `pid`, `id`, `count`, `actionid`, `charges`, `time`, `uniqueid`, `text`, `writer`, `special_description`) VALUES (". $player->getId(). ", 1, 1, 0, 2461, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 2, 2, 0, 2129, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 3, 3, 0, 1987, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 4, 4, 0, 2467, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 5, 5, 0, 2512, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 7, 6, 0, 2649, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 8, 7, 0, 2643, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 0, 8, 3, 2789, 5, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 0, 9, 3, 2412, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 0, 10, 3, 2389, 5, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 0, 11, 3, 2388, 0, 0, 0, 0, 0, '', '', ''), (". $player->getId(). ", 0, 12, 3, 2398, 0, 0, 0, 0, 0, '', '', '');"); //$player->save(); $main_content .= '
    Character Created
    The character '.$newchar_name.' has been created.
    Please select the outfit when you log in for the first time.

    See you in Tibia!

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

  • '; $main_content .= 'Please choose a name'; $main_content .= ', vocation'; $main_content .= ' and sex for your character.
    In any case the name must not violate the naming conventions stated in the '.$config['server']['serverName'].' Rules, or your character might get deleted or name locked.

    Create Character
    '; $main_content .= '
    '; } $main_content .= '
    NameSex

    Please enter your character name.
    '; $main_content .= ' $sample_char) { $main_content .= '
    '; $main_content .= '
    '; } } } } ?>