コード例 #1
0
function delete_player($name)
{
    $SQL = $GLOBALS['SQL'];
    $player = new OTS_Player();
    $player->find($name);
    if ($player->isLoaded()) {
        try {
            $SQL->query("DELETE FROM player_skills WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM guild_invites WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_items WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_depotitems WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_spells WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_storage WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_viplist WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_deaths WHERE player_id = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        try {
            $SQL->query("DELETE FROM player_deaths WHERE killed_by = '" . $player->getId() . "';");
        } catch (PDOException $error) {
        }
        $rank = $player->getRank();
        if (!empty($rank)) {
            $guild = $rank->getGuild();
            if ($guild->getOwner()->getId() == $player->getId()) {
                $rank_list = $guild->getGuildRanksList();
                if (count($rank_list) > 0) {
                    $rank_list->orderBy('level');
                    foreach ($rank_list as $rank_in_guild) {
                        $players_with_rank = $rank_in_guild->getPlayersList();
                        $players_with_rank->orderBy('name');
                        $players_with_rank_number = count($players_with_rank);
                        if ($players_with_rank_number > 0) {
                            foreach ($players_with_rank as $player_in_guild) {
                                $player_in_guild->setRank();
                                $player_in_guild->save();
                            }
                        }
                        $rank_in_guild->delete();
                    }
                    $guild->delete();
                }
            }
        }
        $player->delete();
        return TRUE;
    }
}
コード例 #2
0
</center>';
                        }
                    } 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';
コード例 #3
0
ファイル: items.php プロジェクト: Tobbebror/POT
<?php

// to not repeat all that stuff
include 'quickstart.php';
// loads item typing information
// dont use POT::getInstance() anymore
POT::loadItems('/path/to/your/ots/data/items');
// creates new player object
$player = new OTS_Player();
$player->find('Wrzasq');
/*
    Items loading example.
*/
// loading item from ammunition slot
$item = $player->getSlot(POT::SLOT_AMMO);
echo $player->getName(), ' has item with id ', $item->getId(), ' in his/her ammo slot.', "\n";
// checks if item is a container
if ($item instanceof OTS_Container) {
    // list backpack content
    foreach ($item as $inside) {
        echo 'Container contains item with id ', $inside->getId(), '.', "\n";
    }
}
/*
    Items tree composing example.
*/
// creates container - here it would be a depot locker (we pass ID of item to create)
$container = new OTS_Container(2590);
// now let's create depot chest
$chest = new OTS_Container(2594);
// let's put chest inside locker
コード例 #4
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[] .= 'Esse nome já está em uso. Por favor escolha um outro nome!';
     }
     $number_of_players_on_account = $account_logged->getPlayersList()->count();
     if ($number_of_players_on_account >= $config['site']['max_players_per_account']) {
         $newchar_errors[] .= 'Você tem muitos personagens em sua conta <b>(' . $number_of_players_on_account . '/' . $config['site']['max_players_per_account'] . ')</b>!';
     }
 }
 if (empty($newchar_errors)) {
     $char_to_copy_name = $config['site']['newchar_vocations'][$world_id][$newchar_vocation];
     $char_to_copy = new OTS_Player();
     $char_to_copy->find($char_to_copy_name);
     if (!$char_to_copy->isLoaded()) {
         $newchar_errors[] .= 'Configuração de caracteres inválida. O caractere <b>' . $char_to_copy_name . '</b> não existe.';
     }
 }
 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->setConditions($char_to_copy->getConditions());
コード例 #5
0
if (isset($server_config['mysqlHost'])) {
    //new (0.2.6+) ots config.lua file
    $mysqlhost = $server_config['mysqlHost'];
    $mysqluser = $server_config['mysqlUser'];
    $mysqlpass = $server_config['mysqlPass'];
    $mysqldatabase = $server_config['mysqlDatabase'];
    $sqlitefile = $server_config['sqliteDatabase'];
} elseif (isset($server_config['sqlHost'])) {
    //old (0.2.4) ots config.lua file
    $mysqlhost = $server_config['sqlHost'];
    $mysqluser = $server_config['sqlUser'];
    $mysqlpass = $server_config['sqlPass'];
    $mysqldatabase = $server_config['sqlDatabase'];
    $sqlitefile = $server_config['sqliteDatabase'];
}
// loads #####POT mainfile#####
include '../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));
}
$name_db = new OTS_Player();
$name_db->find($name);
if ($name_db->isLoaded()) {
    echo '<font color="red"><b>Já existe um personagem com esse nome.</b></font>';
} else {
    echo '<font color="green">O seu nome será: "<b>' . ucwords($name) . '</b>"</font>';
}
コード例 #6
0
ファイル: lostaccount.php プロジェクト: s3kk/Gesior
        }
    } elseif ($action == 'setnewpassword') {
        $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 />
コード例 #7
0
ファイル: guilds.php プロジェクト: s3kk/Gesior
        }
    } else {
        $main_content .= "You are not logged in.";
    }
    $main_content .= "<center><h3><a href=\"?subtopic=guilds\">BACK</a></h3></center>";
}
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
//-----------------------------------------------------------------------------//-----------------------------------------------------------------------------
if ($action == 'change_nick') {
    if ($logged) {
        $player_n = stripslashes($_REQUEST['name']);
        $new_nick = stripslashes($_REQUEST['nick']);
        $player = new OTS_Player();
        $player->find($player_n);
        $player_from_account = FALSE;
        if (strlen($new_nick) <= 40) {
            if ($player->isLoaded()) {
                $account_players = $account_logged->getPlayersList();
                if (count($account_players)) {
                    foreach ($account_players as $acc_player) {
                        if ($acc_player->getId() == $player->getId()) {
                            $player_from_account = TRUE;
                        }
                    }
                    if ($player_from_account) {
                        $player->setGuildNick($new_nick);
                        $player->save();
                        $main_content .= 'Guild nick of player <b>' . $player->getName() . '</b> changed to <b>' . htmlentities($new_nick) . '</b>.';
                        $addtolink = '&action=show&guild=' . $player->getRank()->getGuild()->getId();
コード例 #8
0
ファイル: adminpanel.php プロジェクト: s3kk/Gesior
            }
        }
        $main_content .= '<div id="form" style="background: ' . $config['site']['darkborder'] . ';border: 1px solid black;margin: 5px auto;width: 80%;padding: 5px;"><center><b>Form place.</b></center></div>';
        $main_content .= '<table border="0" CELLPADDING=4 CELLSPACING=1 style="border: 1px solid black;margin: 0 auto;width: 80%;">
<TR BGCOLOR="' . $config['site']['vdarkborder'] . '" style="color: white;">
<tr bgcolor=\'#505050\'><td colspan=\'2\' class=\'white\'><center><b>Other systems</b></center></td></tr>
<tr bgcolor=' . $config['site']['lightborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=install_monsters">Reload Monsters</a></b></td><td><small><b>Load information about monsters from directory "/data/monsters/".</b></small> <b><small>[Delete old mosters configuration!]</small></b></td></tr>
<tr bgcolor=' . $config['site']['darkborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=install_spells">Reload Spells</a></b></td><td><small><b>Load information about spells from file "/data/spells/spells.xml".</b></small><br/><b><small>[Delete old spells configuration!]</small></b></td></tr>
<tr bgcolor=' . $config['site']['darkborder'] . '><td width="150"><b><a href="?subtopic=adminpanel&action=npc_check_by_mappingfor&lng=en">Check NPCs</a> [EN]</b></td><td><b><small>Check items prices.</small></b></td></tr>
</table><br/>';
    }
    if (!empty($_GET['name'])) {
        $name = $_GET['name'];
        $name_new = $_GET['name_new'];
        $player = new OTS_Player();
        $player->find($name);
        if ($player->isLoaded() && $player->isNameLocked()) {
            if ($name_new == $player->getOldName()) {
                if ($action == 'accept') {
                    $main_content .= '<font color="green">Changed name from <b>' . $player->getName() . '</b> to <b>' . $player->getOldName() . '</b>.</font>';
                    $player->setCustomField('old_name', $player->getName());
                    $player->setCustomField('name', $player->getOldName());
                    $player->setCustomField('nick_verify', 1);
                    $player->removeNameLock();
                } elseif ($action == 'reject') {
                    $main_content .= '<font color="green">Rejected proposition of change name from <b>' . $player->getName() . '</b> to <b>' . $player->getOldName() . '</b>.</font>';
                    $player->setCustomField('old_name', '');
                }
            } else {
                $main_content .= '<font color="red">Invalid new name. Try again.</font><br>';
            }
コード例 #9
0
ファイル: signature.php プロジェクト: Alexy234/modernaac
// Give the signature a default font style.
$MadGD->setDefaultStyle(BASEPATH_SIGNATURE . 'data/fonts/arial.ttf', BASEPATH_SIGNATURE . 'data/fonts/arialbd.ttf', 8);
// Secure the name against SQL injections.
$name = isset($_GET['name']) ? $_GET['name'] : null;
// Create a few necessary variables.
list($row, $height) = array(0.5, 14);
// Instantiate a new POT object.
$ots = POT::getInstance();
// Connect to the database.
$ots->connect(POT::DB_MYSQL, connection());
// Create a variable holding the database handle.
$SQL = POT::getInstance()->getDBHandle();
// Instantiate a new OTS_PLAYER object.
$character = new OTS_Player();
// Find a player.
$character->find($name);
// Return false in case a player was not found.
if (!$character->isLoaded()) {
    // Send the headers.
    header('Content-type: image/png');
    // Include the cache file.
    include BASEPATH_SIGNATURE . 'images/false-character.png';
    exit;
}
// Get all the cache images.
$cacheImages = scandir(BASEPATH_SIGNATURE . 'cache/');
// Loop through all of the cache images.
foreach ($cacheImages as $cacheImage) {
    // Continue along until you find a matching cache image.
    if (!preg_match('/' . $character->getId() . '_([0-9]{10})\\.png/', $cacheImage)) {
        continue;
コード例 #10
0
ファイル: character.php プロジェクト: Alexy234/modernaac
 public function view($name = null)
 {
     $ide = new IDE();
     if (!empty($name)) {
         $data['character'] = $name;
         $ots = POT::getInstance();
         $ots->connect(POT::DB_MYSQL, connection());
         $player = $ots->createObject('Player');
         $player->find($name);
         if (!$player->isLoaded()) {
             $ide->redirect("../../character/view/");
         } else {
             $data['player'] = $player;
             $data['account'] = $player->getAccount();
         }
         $this->load->view('view_character.php', $data);
     } else {
         $this->load->helper("form");
         if ($_POST) {
             $name = $_POST['name'];
             $ots = POT::getInstance();
             $ots->connect(POT::DB_MYSQL, connection());
             $player = new OTS_Player();
             $player->find($name);
             if ($player->isLoaded()) {
                 $ide->redirect("../character/view/{$name}");
             } else {
                 error("{$name} could not be found.");
             }
         }
         $this->load->view('character_search.php');
     }
 }
コード例 #11
0
ファイル: buypoints.php プロジェクト: Codex-NG/poketibia
    }
    $main_content .= '<tr><td></td><td><input type="submit" value="Check Code" /></td></tr></table></form>';
} elseif ($_REQUEST['system'] == 'dotpay' && $config['dotpay_active']) {
    #################################################################################
    $sms_type = (int) $_POST['sms_type'];
    $posted_code = trim($_POST['code']);
    $to_user = trim($_POST['to_user']);
    $verify_code = trim($_POST['verify_code']);
    #################################################################################
    if (!empty($to_user)) {
        if (is_numeric($to_user)) {
            $account = new OTS_Account();
            $account->find($to_user);
        } else {
            $player = new OTS_Player();
            $player->find($to_user);
            if ($player->isLoaded()) {
                $account = $player->getAccount();
            } else {
                $account = new OTS_Account();
            }
        }
        if (empty($posted_code)) {
            $errors[] = 'Prosze wpisac kod z SMSa/przelewu.';
        }
        if (!$account->isLoaded()) {
            $errors[] = 'Konto/konto postaci o podanym nicku nie istnieje.';
        }
        if (count($errors) == 0) {
            if ($config['site']['verify_code_shop']) {
                //check verification code