} 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; $logged = TRUE; $account->setCustomField("page_lastday", time());
/** * Returns account of this player. * * <p> * Note: Since 0.0.3 version this method throws {@link E_OTS_NotLoaded E_OTS_NotLoaded} exception instead of triggering E_USER_WARNING. * </p> * * @version 0.1.0 * @return OTS_Account Owning account. * @throws E_OTS_NotLoaded If player is not loaded. * @throws PDOException On PDO operation error. */ public function getAccount() { if (!isset($this->data['account_id'])) { throw new E_OTS_NotLoaded(); } $account = new OTS_Account(); $account->load($this->data['account_id']); return $account; }
} } echo "</table>"; if (!$ide->isLogged()) { alert("You need to be logged in to access any options."); } else { require_once 'system/application/libraries/POT/InvitesDriver.php'; new InvitesDriver($guild); $invited_list = $guild->listInvites(); if (count($invited_list) == 0) { echo "<center><b>This guild did not invite anyone.</b></center>"; } else { $ots = POT::getInstance(); $ots->connect(POT::DB_MYSQL, connection()); $account_logged = new OTS_Account(); $account_logged->load($_SESSION['account_id']); $account_players = $account_logged->getPlayers(); echo "<table width='100%'>"; echo "<tr><td><center><b>Name</b></center></td><td><center><b>Join</b></center></td></tr>"; $characters = array(); foreach ($account_players as $player_from_acc) { $characters[] = $player_from_acc->getName(); } foreach ($invited_list as $invited_player) { if (in_array($invited_player->getName(), $characters)) { echo "<tr><td><center><a href='" . WEBSITE . "/index.php/character/view/" . $invited_player->getName() . "'>" . $invited_player->getName() . "</a></center></td><td><center><a href='" . WEBSITE . "/index.php/guilds/join/" . $guild->getId() . "/" . $invited_player->getId() . "'>Join</a></center></td></tr>"; } else { echo "<tr><td><center><a href='" . WEBSITE . "/index.php/character/view/" . $invited_player->getName() . "'>" . $invited_player->getName() . "</a></center></td><td><center>Cannot join</center></td></tr>"; } } echo "</table>";
echo '<image src="../images/false.gif"> <font color="red">Invalid account name format. Use only A-Z and numbers 0-9.</font>'; exit; } //connect to DB $server_config = parse_ini_file($config_ini['server_path'] . 'config.lua'); if (isset($server_config['sqlHost'])) { $mysqlhost = $server_config['sqlHost']; $mysqluser = $server_config['sqlUser']; $mysqlpass = $server_config['sqlPass']; $mysqldatabase = $server_config['sqlDatabase']; $sqlitefile = $server_config['sqliteDatabase']; } // loads #####POT mainfile##### include '../libs/pot/OTS.php'; // PDO and POT connects to database $ots = POT::getInstance(); if ($server_config['sqlType'] == "mysql") { $ots->connect(POT::DB_MYSQL, array('host' => $mysqlhost, 'user' => $mysqluser, 'password' => $mysqlpass, 'database' => $mysqldatabase)); } elseif ($server_config['sqlType'] == "sqlite") { $ots->connect(POT::DB_SQLITE, array('database' => $config_ini['server_path'] . $sqlitefile)); } $account_db = new OTS_Account(); $account_db->load($account); if ($account_db->isLoaded()) { echo '<image src="../images/false.gif"> <font color="red">Account with this name already exist.</font>'; } else { echo '<image src="../images/true.gif"> <font color="green">Your account name will be: ' . $account . '</font>'; } } else { echo '<image src="../images/false.gif"> <font color="red">Account name is too long (max. 30 chars).</font>'; }
<?php // to not repeat all that stuff include 'quickstart.php'; // creates new account object $account = new OTS_Account(); // loads account with ID (account number) 111111 $account->load(111111); // alternative way - shorter $account2 = new OTS_Account(111111); // WARNING! This one won't work! //$account2 = new OTS_Account('111111'); // '111111' is a string! not integer // shows results of loading account echo '111111 e-mail address: ', $account->getEMail();