Example #1
0
         echo 'All samples added to database. Now you can go to <a href="install.php?page=step&step=5&server_conf=yes">STEP 5 - Set Admin Account</a><br/>';
     }
 }
 if ($step == '5') {
     echo '<h1>STEP ' . $step . '</h1>Set Admin Account<br>';
     $config['server'] = parse_ini_file($config['site']['server_path'] . 'config.lua');
     if (empty($_REQUEST['saveaccpassword'])) {
         echo 'Admin account number is: <b>1</b><br/>Set new password to this account.<br>';
         echo 'New password: <form action="install.php" method=POST><input type="text" name="newpass" size="35">(Don\'t give it password to anyone!)';
         echo '<input type="hidden" name="saveaccpassword" value="yes"><input type="hidden" name="page" value="step"><input type="hidden" name="step" value="5"><input type="submit" value="SET"></form><br>If account with number 1 doesn\'t exist installator will create it and set your password.';
     } else {
         $newpass = $_POST['newpass'];
         if (!check_password($newpass)) {
             echo 'Password contains illegal characters. Please use only a-Z and 0-9. <a href="install.php?page=step&step=5&server_conf=yes">GO BACK</a> and write other password.';
         } else {
             $newpass_to_db = password_ency($newpass);
             $account = new OTS_Account();
             $account->load(1);
             if ($account->isLoaded()) {
                 $account->setPassword($newpass_to_db);
                 $account->save();
                 $account->setCustomField("page_access", 6);
             } else {
                 $number = $account->create(1, 1, 1);
                 $account->setPassword($newpass_to_db);
                 $account->unblock();
                 $account->save();
                 $account->setCustomField("page_access", 6);
             }
             $_SESSION['account'] = 1;
             $_SESSION['password'] = $newpass;
             } else {
                 $main_content .= 'O personagem com esse nome não existe ou não está com o nome trancado.';
             }
         } else {
             $main_content .= 'Esse nome contém caracteres ilegais, formato inválido ou tamanho incorreto.';
         }
     } else {
         $main_content .= 'Por favor entre com o novo nome.';
     }
     $main_content .= '<br /><center><table border="0" cellspacing="0" cellpadding="0" ><form action="index.php?subtopic=accountmanagement" method="post" ><tr><td style="border:0px;" ><div class="BigButton" style="background-image:url(' . $layout_name . '/images/buttons/sbutton.gif)" ><div onMouseOver="MouseOverBigButton(this);" onMouseOut="MouseOutBigButton(this);" ><div class="BigButtonOver" style="background-image:url(' . $layout_name . '/images/buttons/sbutton_over.gif);" ></div><input class="ButtonText" type="image" name="Back" alt="Back" src="' . $layout_name . '/images/buttons/_sbutton_back.gif" ></div></div></td></tr></form></table></center>';
 }
 //### DELETE character from account ###
 if ($action == "deletecharacter") {
     $player_name = stripslashes(trim($_GET['name']));
     $password_verify = trim($_POST['delete_password']);
     $password_verify = password_ency($password_verify);
     if ($_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()) {
                                 // show table "delete character" again
                                 $dontshowtableagain = 1;
                                 //delete player
                                 $player->setCustomField('deleted', 1);
                                 $main_content .= '
Example #3
0
if (isset($_SESSION['account'])) {
    $account_logged = $ots->createObject('Account');
    $account_logged->load($_SESSION['account']);
    if ($account_logged->isLoaded() && $account_logged->getPassword() == $_SESSION['password']) {
        $logged = TRUE;
        $group_id_of_acc_logged = $account_logged->getPageAccess();
    } else {
        $logged = FALSE;
        unset($_SESSION['account']);
        unset($account_logged);
    }
}
$login_account = strtoupper(trim($_POST['account_login']));
$login_password = trim($_POST['password_login']);
if (!$logged && !empty($login_account) && !empty($login_password)) {
    $login_password = password_ency($login_password);
    $account_logged = $ots->createObject('Account');
    $account_logged->find($login_account);
    if ($account_logged->isLoaded()) {
        if ($login_password == $account_logged->getPassword()) {
            $_SESSION['account'] = $account_logged->getId();
            $_SESSION['password'] = $login_password;
            $logged = TRUE;
            $account_logged->setCustomField("page_lastday", time());
            $group_id_of_acc_logged = $account_logged->getPageAccess();
        } else {
            $logged = FALSE;
        }
    }
}
//#### LOAD PAGE ##########
Example #4
0
            $main_content .= '<font color="red"><b>Error. Try again.</b></font><br />Please enter code from e-mail and name of one character from account. Then press Submit.<BR>
					<BR><FORM ACTION="?subtopic=lostaccount&action=checkcode" METHOD=post>
					<TABLE CELLSPACING=0 CELLPADDING=0 BORDER=0 WIDTH=100%><TR><TD><center>
					<INPUT TYPE=image NAME="Back" ALT="Back" SRC="' . $layout_name . '/images/buttons/sbutton_back.gif" BORDER=0 WIDTH=120 HEIGHT=18></center>
					</TD></TR></FORM></TABLE></TABLE>';
        } else {
            $player = new OTS_Player();
            $account = new OTS_Account();
            $player->find($character);
            if ($player->isLoaded()) {
                $account = $player->getAccount();
            }
            if ($account->isLoaded()) {
                if ($account->getCustomField('email_code') == $code) {
                    if (check_password($newpassword)) {
                        $account->setPassword(password_ency($newpassword));
                        $account->save();
                        $account->setCustomField('email_code', '');
                        $main_content .= 'New password to your account is below. Now you can login.<BR>
					<INPUT TYPE=hidden NAME="character" VALUE="' . $character . '">
					<TABLE CELLSPACING=1 CELLPADDING=4 BORDER=0 WIDTH=100%>
					<TR><TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Changed password</B></TD></TR>
					<TR><TD BGCOLOR="' . $config['site']['darkborder'] . '">
					New password:&nbsp;<b>' . $newpassword . '</b><BR />
					Account name:&nbsp;&nbsp;&nbsp;<i>(Already on your e-mail)</i><BR />';
                        $mailBody = '<html>
						<body>
						<h3>Your account name and password!</h3>
						<p>Changed password to your account in Lost Account Interface on server <a href="' . $config['server']['url'] . '"><b>' . $config['server']['serverName'] . '</b></a></p>
						<p>Account name: <b>' . $account->getName() . '</b></p>
						<p>New password: <b>' . $newpassword . '</b></p>
Example #5
0
            for ($i = 1; $i <= 6; $i++) {
                $reg_password .= mt_rand(0, 9);
            }
        }
        $reg_account = $ots->createObject('Account');
        $number = $reg_account->create(0, 9999999, $reg_name);
        // saves account information in database
        $reg_account->setEMail($reg_email);
        if ($config['site']['choose_countr']) {
            $reg_account->setCustomField("flag", $reg_country);
        }
        if ($config['site']['referrer']) {
            $reg_account->setCustomField("ref", $reg_referrer);
            $SQL->query('INSERT INTO z_referers (account_id, ref_account_id) VALUES (' . $number . ', ' . $reg_referrer . ')');
        }
        $reg_account->setPassword(password_ency($reg_password));
        $reg_account->unblock();
        $reg_account->save();
        $reg_account->setCustomField("created", time());
        $reg_account->setCustomField("lastday", time());
        if ($config['site']['newaccount_premdays']) {
            $reg_account->setCustomField("premdays", $config['site']['newaccount_premdays']);
            $reg_account->setCustomField("lastpremdays", time() + $config['site']['newaccount_premdays'] * 24 * 60 * 60);
        }
        //show information about registration
        $main_content .= 'Your account has been created. Please write down the account number and password. See you in Tibia!<BR><BR>
		<TABLE WIDTH=100% BORDER=0 CELLSPACING=1 CELLPADDING=4>
			<TR>
				<TD BGCOLOR="' . $config['site']['vdarkborder'] . '" CLASS=white><B>Account Created</B></TD>
			</TR>
			<TR>