Esempio n. 1
0
 } else {
     $buy_offer = getItemByID($buy_id);
     $check_name_in_database = $ots->createObject('Player');
     $check_name_in_database->find($buy_from);
     if ($buy_offer['type'] == 'changename') {
         if (!$check_name_in_database->isLoaded()) {
         }
     }
     if (isset($buy_offer['id'])) {
         //item exist in database
         if ($user_premium_points >= $buy_offer['points']) {
             if (check_name($buy_name)) {
                 $buy_player = new OTS_Player();
                 $buy_player->find($buy_name);
                 if ($buy_player->isLoaded()) {
                     $buy_player_account = $buy_player->getAccount();
                     if ($_SESSION['viewed_confirmation_page'] == 'yes' && $_POST['buy_confirmed'] == 'yes') {
                         if ($buy_offer['type'] == 'pacc') {
                             $player_premdays = $buy_player_account->getCustomField('premdays');
                             $player_lastlogin = $buy_player_account->getCustomField('lastday');
                             $save_transaction = 'INSERT INTO ' . $SQL->tableName('z_shop_history_pacc') . ' (id, to_name, to_account, from_nick, from_account, price, pacc_days, trans_state, trans_start, trans_real) VALUES (NULL, ' . $SQL->quote($buy_player->getName()) . ', ' . $SQL->quote($buy_player_account->getId()) . ', ' . $SQL->quote($buy_from) . ', ' . $SQL->quote($account_logged->getId()) . ', ' . $SQL->quote($buy_offer['points']) . ', ' . $SQL->quote($buy_offer['days']) . ', \'realized\', ' . $SQL->quote(time()) . ', ' . $SQL->quote(time()) . ');';
                             $SQL->query($save_transaction);
                             $buy_player_account->setCustomField('premdays', $player_premdays + $buy_offer['days']);
                             $account_logged->setCustomField('premium_points', $user_premium_points - $buy_offer['points']);
                             $user_premium_points = $user_premium_points - $buy_offer['points'];
                             $color1 = 'green';
                             $color2 = 'green';
                             $color3 = 'green';
                             $color4 = 'green';
                             $color5 = 'green';
                             $main_content .= '
Esempio n. 2
0
        $newpassword = $_REQUEST['passor'];
        $code = $_REQUEST['code'];
        $character = stripslashes($_REQUEST['character']);
        $main_content .= '';
        if (empty($code) || empty($character) || empty($newpassword)) {
            $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>
Esempio n. 3
0
        $row++;
    }
}
// Player Guild
if ($character->getRank() != null) {
    $MadGD->addText('Guild Membership:', $MadGD->textBold)->setPosition(10, $row * $height);
    $MadGD->addText($character->getRank()->getName() . ' of the ' . $character->getRank()->getGuild()->getName())->setPosition();
    $row++;
}
// Player Last Login
$MadGD->addText('Last login:'******'Never logged in' : gmdate('M d Y, H:i:s T', $character->getLastLogin()))->setPosition();
$row++;
// Account Status
$MadGD->addText('Account Status:', $MadGD->textBold)->setPosition(10, $row * $height);
$MadGD->addText($character->getAccount()->getPremDays() > 0 ? 'Premium Account' : 'Free Account')->setPosition();
$row++;
// Define all of the slot ids with their names.
$slots = array(2 => 'amulet', 1 => 'helmet', 3 => 'backpack', 6 => 'lefthand', 4 => 'armor', 5 => 'righthand', 9 => 'ring', 7 => 'legs', 10 => 'ammunition', 8 => 'boots');
// Loop through all of the slots.
foreach ($slots as $pid => $name) {
    // Run a SQL query to fetch the slot items.
    $item = $SQL->query('SELECT `itemtype`, `count` FROM `player_items` WHERE `player_id` = ' . $character->getId() . ' AND `pid` = ' . $pid . ';')->fetch();
    // Continue to the next slot item in case there is no item at the current slot.
    if ($item['itemtype'] == null) {
        continue;
    }
    // Set the default count to one.
    $count = $item['count'] > 0 ? $item['count'] : 1;
    // Set the image path.
    $imagePath = FCPATH . 'public/images/items/' . ($count > 1 ? $item['itemtype'] . '/' . $count : $item['itemtype']) . '.gif';
Esempio n. 4
0
         $guild_errors[] = 'Guild with ID <b>' . $guild_name . '</b> doesn\'t exist.';
     }
 }
 if (empty($guild_errors)) {
     $guild_owner_id = $guild->getOwner()->getId();
     if ($_REQUEST['todo'] == 'save') {
         if (!check_name($name)) {
             $guild_errors[] = 'Invalid name format.';
         }
         if (empty($guild_errors)) {
             $player = new OTS_Player();
             $player->find($name);
             if (!$player->isLoaded()) {
                 $guild_errors[] = 'Character <b>' . $name . '</b> doesn\'t exist.';
             } else {
                 if ($player->getAccount()->getId() != $account_logged->getId()) {
                     $guild_errors[] = 'Character <b>' . $name . '</b> isn\'t from your account!';
                 }
             }
         }
         if (empty($guild_errors)) {
             $player_loaded_rank = $player->getRank();
             if (!empty($player_loaded_rank) && $player_loaded_rank->isLoaded()) {
                 if ($player_loaded_rank->getGuild()->getId() != $guild->getId()) {
                     $guild_errors[] = 'Character <b>' . $name . '</b> isn\'t from guild <b>' . $guild->getName() . '</b>.';
                 }
             } else {
                 $guild_errors[] = 'Character <b>' . $name . '</b> isn\'t in any guild.';
             }
         }
         if (empty($guild_errors)) {
Esempio n. 5
0
 public function join($guild_name, $player_name)
 {
     $guild_name = (int) $guild_name;
     $player_name = (int) $player_name;
     $ide = new IDE();
     if (empty($guild_name) or empty($player_name)) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $ots = POT::getInstance();
     $ots->connect(POT::DB_MYSQL, connection());
     $guild = $ots->createObject('Guild');
     $guild->load($guild_name);
     if (!$guild->isLoaded()) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $player = new OTS_Player();
     $player->load($player_name);
     if (!$player->isLoaded()) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     if ($player->getAccount()->getId() != $_SESSION['account_id']) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     require_once 'system/application/libraries/POT/InvitesDriver.php';
     new InvitesDriver($guild);
     $invited_list = $guild->listInvites();
     if (!in_array($player->getId(), $invited_list)) {
         $ide->redirect(WEBSITE . "/index.php/guilds");
     }
     $guild->acceptInvite($player);
     $ide->redirect(WEBSITE . "/index.php/guilds/view/" . $guild->getId() . "/1");
 }