当前位置: 首页>>代码示例>>PHP>>正文


PHP delete_item函数代码示例

本文整理汇总了PHP中delete_item函数的典型用法代码示例。如果您正苦于以下问题:PHP delete_item函数的具体用法?PHP delete_item怎么用?PHP delete_item使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。


在下文中一共展示了delete_item函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: decrease_misc

function decrease_misc($item, $count)
{
    //$item = preg_replace ('/[^a-z0-9_\.]/i', '', $item);
    $count = preg_replace('/[^0-9]/', '', $count);
    // vozmem nachalqnoe kolichestvo
    $sc = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $item . "';");
    $sc = mysql_result($sc, 0);
    // esli count menqshe nulja, tupaja oshibka
    if ($count <= 0) {
        //put_error ('уменьшить на минусовое число нелзя, надо использовать увеличить');
        return 0;
    }
    // esli otnjav poluchitsja menqshe 0 tozhe nelzja, ob etom pozabotitsja nado v skriptah
    if ($sc - $count < 0) {
        //put_error ('как ты считал балбес, ведь меньше 0 получается');
        return 0;
    }
    // esli vse prodolzhaetsja, uvelichim i obnovim
    $nc = $sc - $count;
    if ($nc < 1) {
        include_once 'modules/f_delete.php';
        delete_item($item);
    }
    do_mysql("UPDATE items SET on_take = '" . $nc . "' WHERE fullname = '" . $item . "';");
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:26,代码来源:f_decrease_misc.php

示例2: decr_abstr_misc

function decr_abstr_misc($prot, $who, $count, $other = 0)
{
    //$prot = preg_replace ('/[^a-z0-9_\.]/i', '', $prot);
    $count = preg_replace('/[^0-9]/', '', $count);
    //$who = preg_replace ('/[^a-z0-9_]/i', '', $who);
    if (!is_player($who)) {
        return 0;
    }
    if ($count < 1) {
        return 0;
    }
    $q = do_mysql("SELECT on_take FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $ci = mysql_result($q, 0);
    if ($ci < $count) {
        return 0;
    }
    $ci -= $count;
    if ($ci) {
        do_mysql("UPDATE items SET on_take = '" . $ci . "' WHERE  belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "';");
    } else {
        include_once 'modules/f_delete_item.php';
        $q = do_mysql("SELECT fullname FROM items WHERE belongs = '" . $who . "' AND is_in = 'inv' AND realname = '" . $prot . "' AND type = 'm';");
        $item = mysql_result($q, 0);
        delete_item($item);
    }
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:30,代码来源:f_decr_abstr_misc.php

示例3: teach_magic_from_sc

function teach_magic_from_sc($scroll, $npc, $login)
{
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$npc = preg_replace ('/[^a-z0-9_\.]/i', '', $npc);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    $nid = is_npc($npc);
    $id = is_player($login);
    // v odnoj li lokacii
    $q = do_mysql("SELECT location FROM npc WHERE id_npc = '" . $nid . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc1 = mysql_result($q, 0);
    $q = do_mysql("SELECT location FROM players WHERE id_player = '" . $id . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $loc2 = mysql_result($q, 0);
    if ($loc1 != $loc2) {
        return 0;
    }
    include_once 'modules/f_has_item.php';
    if (!has_item($scroll, $login)) {
        put_g_error('у вас нету свитка!');
    }
    $q = do_mysql("SELECT on_take, price FROM items WHERE fullname = '" . $scroll . "' AND type = 's';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_fetch_assoc($q);
    // neumeet li on uzhe
    include_once 'modules/f_has_magic.php';
    if (has_magic($spell['on_take'], $login)) {
        put_g_error('вы уже умеете это заклинание!');
    }
    // cenu vyschitaem:
    $q = do_mysql("SELECT money FROM players WHERE id_player = '" . $id . "';");
    $money = mysql_result($q, 0);
    $cost = $spell['price'] * 10;
    if ($money < $cost) {
        put_g_error('нехватает серебра, нужно ' . $cost . ' серебреных!');
    }
    $money -= $cost;
    // dobavljaem zakl:
    $q = do_mysql("SELECT magic FROM players WHERE id_player = '" . $id . "';");
    $magic = mysql_result($q, 0);
    if (!$magic) {
        $magic = $spell['on_take'];
    } else {
        $magic .= '|' . $spell['on_take'];
    }
    // obnovim dannye:
    do_mysql("UPDATE players SET magic = '" . $magic . "', money = '" . $money . "' WHERE id_player = '" . $id . "';");
    // udaljaem svitok
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    $q = do_mysql("SELECT name FROM magic WHERE fullname = '" . $spell['on_take'] . "';");
    $name = mysql_result($q, 0);
    exit_msg('магия', 'вы выучили заклинание ' . $name . ' за ' . $cost . ' серебреных!');
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:60,代码来源:f_teach_magic_from_sc.php

示例4: deleteitem

function deleteitem($plu)
{
    global $FANNIE_ROOT, $FANNIE_SCALES;
    $CSV_dir = $FANNIE_ROOT . 'item/hobartcsv/csvfiles';
    $DGW_dir = $FANNIE_ROOT . 'item/hobartcsv/csv_output';
    if (!function_exists('writeitem')) {
        include 'writecsv.php';
    }
    $session_key = '';
    for ($i = 0; $i < 20; $i++) {
        $num = rand(97, 122);
        $session_key = $session_key . chr($num);
    }
    $i = 0;
    foreach ($FANNIE_SCALES as $f) {
        delete_item("{$CSV_dir}/{$session_key}_di_scale_{$i}.csv", $f['type'], $f['host'], $f['dept'], $plu);
        delete_text("{$CSV_dir}/{$session_key}_dt_scale_{$i}.csv", $f['type'], $f['host'], $f['dept'], $plu);
        $i++;
    }
    for ($i = 0; $i < count($FANNIE_SCALES); $i++) {
        copy($CSV_dir . "/" . $session_key . "_di_scale_" . $i . ".csv", $DGW_dir . "/" . $session_key . "_di_scale_" . $i . ".csv");
        unlink($CSV_dir . "/" . $session_key . "_di_scale_" . $i . ".csv");
        copy($CSV_dir . "/" . $session_key . "_dt_scale_" . $i . ".csv", $DGW_dir . "/" . $session_key . "_dt_scale_" . $i . ".csv");
        unlink($CSV_dir . "/" . $session_key . "_dt_scale_" . $i . ".csv");
    }
}
开发者ID:phpsmith,项目名称:IS4C,代码行数:26,代码来源:parse.php

示例5: hunterslodge_customtitle_run

function hunterslodge_customtitle_run()
{
    require_once "lib/sanitize.php";
    require_once "lib/names.php";
    global $session;
    $op = httpget("op");
    $free = httpget("free");
    page_header("Choose your Custom Title");
    switch ($op) {
        case "change":
            output("Ready to change your Title?  No problem.  Enter your desired Title in the box below.  You've got 25 characters to play with, including colour codes.`n`n");
            titlechange_form();
            addnav("Cancel");
            addnav("Don't change colours, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
        case "confirm":
            $ntitle = rawurldecode(httppost('newname'));
            $ntitle = newline_sanitize($ntitle);
            if ($ntitle == "") {
                $ntitle = "`0";
            }
            $ntitle = preg_replace("/[`][cHw]/", "", $ntitle);
            $ntitle = sanitize_html($ntitle);
            $nname = get_player_basename();
            output("`0Your new title will look like this: %s`0`n", $ntitle);
            output("`0Your entire name will look like: %s %s`0`n`n", $ntitle, $nname);
            output("Do you want to set the new title now?`n`n");
            output("`0Try a different title below, if you like.`n`n");
            titlechange_form();
            addnav("Confirm");
            addnav("Set the new Title", "runmodule.php?module=hunterslodge_customtitle&op=set&free={$free}&newname=" . rawurlencode($ntitle));
            addnav("Cancel");
            addnav("Don't change your Title, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
        case "set":
            $ntitle = rawurldecode(httpget('newname'));
            $fromname = $session['user']['name'];
            $newname = change_player_ctitle($ntitle);
            $session['user']['ctitle'] = $ntitle;
            $session['user']['name'] = $newname;
            output("You are now known as %s!`0`n`n", $session['user']['name']);
            if (!$free) {
                $id = has_item("hunterslodge_customtitle");
                delete_item($id);
            }
            addnav("Return");
            addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
    }
    page_footer();
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:51,代码来源:hunterslodge_customtitle.php

示例6: hunterslodge_customrace_run

function hunterslodge_customrace_run()
{
    require_once "lib/sanitize.php";
    require_once "lib/names.php";
    global $session;
    $op = httpget("op");
    $free = httpget("free");
    page_header("Choose your Custom Race");
    switch ($op) {
        case "change":
            output("Want to change your Custom Race?  No problem.  Enter your desired race in the box below.  You've got 25 characters to play around with.`n(leave this blank to disable custom race naming and return to default, game-supplied race names)`n`n");
            rawoutput("<form action='runmodule.php?module=hunterslodge_customrace&op=confirm&free=" . $free . "' method='POST'>");
            $race = get_module_pref("customrace");
            rawoutput("<input id='input' name='newrace' width='25' maxlength='25' value='" . htmlentities($race, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
            rawoutput("<input type='submit' class='button' value='Preview'>");
            rawoutput("</form>");
            addnav("", "runmodule.php?module=hunterslodge_customrace&op=confirm&free=" . $free);
            addnav("Cancel");
            addnav("Don't set a custom race, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
        case "confirm":
            $newrace = httppost("newrace");
            $sub = httpget("sub");
            $newrace = str_replace("`", "", $newrace);
            $newrace = comment_sanitize($newrace);
            $newrace = substr($newrace, 0, 25);
            if ($newrace) {
                output("Your new custom race is:`n%s`nWould you like to set your new Race now?`n`n", $newrace);
            } else {
                output("You've chosen to go back to the default, game-supplied races.  Are you sure that's what you want?`n`n");
            }
            addnav("Confirm");
            addnav("Set custom race", "runmodule.php?module=hunterslodge_customrace&op=set&free={$free}&newrace=" . rawurlencode($newrace));
            addnav("Cancel");
            addnav("Don't set a custom race, just go back to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
        case "set":
            $newrace = rawurldecode(httpget("newrace"));
            output("Your custom race has been set to %s!`n`n", $newrace);
            set_module_pref("customrace", $newrace);
            if (!$free) {
                $id = has_item("hunterslodge_customrace");
                delete_item($id);
            }
            addnav("Return");
            addnav("Return to the Lodge", "runmodule.php?module=iitems_hunterslodge&op=start");
            break;
    }
    page_footer();
}
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:50,代码来源:hunterslodge_customrace.php

示例7: cratesniffer_use

function cratesniffer_use($args)
{
    output("`0You thumb the switch on your Crate Sniffer.  It buzzes and hisses for a moment, exhausting its primitive battery sending out a radio ping to nearby Crates.`n`n");
    $ploc = get_module_pref("worldXYZ", "worldmapen");
    list($px, $py, $pz) = explode(",", $ploc);
    $pxlow = $px - 3;
    $pxhigh = $px + 3;
    $pylow = $py - 3;
    $pyhigh = $py + 3;
    $potentialowners = array();
    $x = -3;
    $y = -3;
    $cont = true;
    while ($cont) {
        $ox = $px + $x;
        $oy = $py + $y;
        $owner = "worldmap_{$ox},{$oy},1";
        //debug($owner);
        $potentialowners[] = $owner;
        if ($x == 3 && $y == 3) {
            $cont = false;
            break;
        }
        if ($y == 3) {
            $x++;
            $y = -3;
        } else {
            $y++;
        }
    }
    //debug($potentialowners);
    $sql = "SELECT count(item) AS c FROM " . db_prefix("items_player") . " WHERE item='supplycrate' AND owner IN (";
    foreach ($potentialowners as $owner) {
        $sql .= "'" . $owner . "',";
    }
    $sql = substr_replace($sql, "", -1);
    $sql .= ")";
    //debug($sql);
    $result = db_query($sql);
    $row = db_fetch_assoc($result);
    $count = $row['c'];
    output("It displays, weakly, the number `\$`b%s`b`0 in dull red LED's before its radio module catches fire.`n`n", $count);
    delete_item($args['id']);
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:45,代码来源:cratesniffer.php

示例8: add_sc_to_book

function add_sc_to_book($scroll, $book, $login)
{
    // v has_item proveritsja
    //$scroll = preg_replace ('/[^a-z0-9_\.]/i', '', $scroll);
    //$book = preg_replace ('/[^a-z0-9_\.]/i', '', $book);
    //$login = preg_replace ('/[^a-z0-9_]/i', '', $login);
    include_once 'modules/f_has_item.php';
    if (!has_item($scroll, $login)) {
        put_g_error('у вас нету свитка');
    }
    if (!has_item($book, $login)) {
        put_g_error('у вас нету книги');
    }
    // tolqko esli estq navyk:
    $q = do_mysql("SELECT skills FROM players WHERE login = '" . $login . "';");
    $skills = mysql_result($q, 0);
    $skills = explode('|', $skills);
    if (!$skills[30]) {
        put_g_error('у вас нету навыка');
    }
    // dobavim:
    $q = do_mysql("SELECT on_take FROM items WHERE fullname = '" . $book . "' AND type = 'b';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $mlist = mysql_result($q, 0);
    $q = do_mysql("SELECT on_take FROM items WHERE type = 's' AND fullname = '" . $scroll . "';");
    if (!mysql_num_rows($q)) {
        return 0;
    }
    $spell = mysql_result($q, 0);
    if (strpos($mlist, $spell) !== false) {
        put_g_error('в этой книге уже есть это заклинание!');
    }
    if ($mlist) {
        $mlist .= '~' . $spell;
    } else {
        $mlist = $spell;
    }
    do_mysql("UPDATE items SET on_take = '" . $mlist . "' WHERE fullname = '" . $book . "';");
    // udalim svitok:
    include_once 'modules/f_delete_item.php';
    delete_item($scroll);
    return 1;
}
开发者ID:nadvamir,项目名称:forgotten-story-mmorpg,代码行数:45,代码来源:f_add_sc_to_book.php

示例9: deleteitem

function deleteitem($plu, $scalenum)
{
    include 'ini.php';
    $session_key = '';
    for ($i = 0; $i < 20; $i++) {
        $num = rand(97, 122);
        $session_key = $session_key . chr($num);
    }
    for ($i = 0; $i < $num_scales; $i++) {
        delete_item("{$CSV_dir}/{$session_key}_di_scale_{$i}.csv", $scale_types[$i], $scale_ips[$i], $department, $plu);
        delete_text("{$CSV_dir}/{$session_key}_dt_scale_{$i}.csv", $scale_types[$i], $scale_ips[$i], $department, $plu);
    }
    for ($i = 0; $i < $num_scales; $i++) {
        exec("cp {$CSV_dir}/{$session_key}_di_scale_{$i}.csv {$DGW_dir}");
        exec("rm -f {$CSV_dir}/{$session_key}_di_scale_{$i}.csv");
        exec("cp {$CSV_dir}/{$session_key}_dt_scale_{$i}.csv {$DGW_dir}");
        exec("rm -f {$CSV_dir}/{$session_key}_dt_scale_{$i}.csv");
    }
}
开发者ID:phpsmith,项目名称:IS4C,代码行数:19,代码来源:parse.php

示例10: hunterslodge_healthinsurance_use

function hunterslodge_healthinsurance_use($args)
{
    global $session;
    $id = $args['id'];
    $expirationtime = get_item_pref("expiration_timestamp", $id);
    if (!$expirationtime) {
        $expires = time() + 604800;
        set_item_pref("expiration_timestamp", $expires, $id);
        output("`0This is the first time you've used this certificate.  It will expire exactly one week from now.`n`n");
    } else {
        if (time() > $expirationtime) {
            output("This certificate has now expired!`n`n");
            delete_item($id);
        } else {
            require_once "lib/datetime.php";
            $expirein = reltime($expirationtime, false);
            output("This certificate will expire in %s.`n`n", $expirein);
        }
    }
    $args['destroyafteruse'] = false;
    return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:22,代码来源:hunterslodge_healthinsurance.php

示例11: delete

 /**
  * Delete items
  *
  * {@source}
  * @access public
  * @static
  * @since 1.8
  * @version 1
  *
  * @static
  * @param array $itemids
  * @return array|boolean
  */
 public static function delete($itemids)
 {
     $result = delete_item($itemids);
     if ($result) {
         return $itemids;
     } else {
         self::$error = array('error' => ZBX_API_ERROR_INTERNAL, 'data' => 'Internal zabbix error');
         return false;
     }
 }
开发者ID:phedders,项目名称:zabbix,代码行数:23,代码来源:class.citem.php

示例12: meatsystem_run


//.........这里部分代码省略.........
            if ($meat1 < 0 || $meat2 < 0 || $meat3 < 0) {
                page_header("Either taking vegetarianism to whole new levels, or trying to grow meat from an empty pan");
                output("You want to cook `inegative`i meat?  How very Zen of you.`n`n");
                addnav("You sneaky bugger");
                addnav("Abandon your efforts to produce the opposite of meat and try again, pretending that you weren't just trying to cheat.", "runmodule.php?module=meatsystem&op=cook&from=" . $from);
                break;
            }
            //check for the dumbass player trying to put too much meat in the pan
            $totalmeat = $meat1 + $meat2 + $meat3;
            if ($totalmeat > 20) {
                output("Your pan can't hold that much meat, pal.`n`n");
                addnav("Whoops");
                addnav("Try again, without filling the pan up so much", "runmodule.php?module=meatsystem&op=cook&from=" . $from);
                break;
            }
            //check for the dumbass player trying to cook no meat at all
            $totalmeat = $meat1 + $meat2 + $meat3;
            if ($totalmeat == 0) {
                output("You start the process of cooking up your tasty meat.  After a few minutes of poking around in your pan, growing hungrier by the second, you realise that you've forgotten something.`n`n");
                addnav("Whoops");
                addnav("Try again, with meat this time", "runmodule.php?module=meatsystem&op=cook&from=" . $from);
                break;
            }
            //Stamina interaction, including consequences and level-up details.
            $amber = get_stamina();
            $return = process_action("Cooking");
            if ($return['lvlinfo']['levelledup'] == true) {
                output("`n`c`b`0You gained a level in Cooking!  You are now level %s!  This action will cost fewer Stamina points now, so you can cook more tasty meals each day!`b`c`n", $return['lvlinfo']['newlvl']);
            }
            $failchance = e_rand(0, 100);
            if ($failchance > $amber) {
                output("`4You put your meat into the pan, and sit down to stir-fry it.  The hypnotic motion and white-noise sizzling, combined with your tiredness, sends you staring into space.  While your concentration is impaired, the meat bursts into flames.  You jerk back into awareness, and look down sadly at the flaming chunks.  Bummer.");
                for ($i = 0; $i < $meat1; $i++) {
                    delete_item(has_item("meat_low"));
                }
                for ($i = 0; $i < $meat2; $i++) {
                    delete_item(has_item("meat_medium"));
                }
                for ($i = 0; $i < $meat3; $i++) {
                    delete_item(has_item("meat_high"));
                }
                break;
            }
            //we can now assume that the player is not some sort of cheating reprobate, or trying to cook while dog-tired, and do some cooking!
            for ($i = 0; $i < $meat1; $i++) {
                increment_module_pref("nutrition", 1, "staminafood");
                increment_module_pref("fat", 3, "staminafood");
                increment_module_pref("fullness", 1, "staminafood");
                delete_item(has_item("meat_low"));
                addstamina(1000);
            }
            for ($i = 0; $i < $meat2; $i++) {
                increment_module_pref("nutrition", 2, "staminafood");
                increment_module_pref("fat", 2, "staminafood");
                increment_module_pref("fullness", 1, "staminafood");
                delete_item(has_item("meat_medium"));
                addstamina(2000);
            }
            for ($i = 0; $i < $meat3; $i++) {
                increment_module_pref("nutrition", 3, "staminafood");
                increment_module_pref("fat", 1, "staminafood");
                increment_module_pref("fullness", 1, "staminafood");
                delete_item(has_item("meat_high"));
                addstamina(5000);
            }
            output("You fry up your lovely meaty loveliness, and sit down to eat.  You gain some Stamina!`n`n");
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:67,代码来源:meatsystem.php

示例13: oneshotteleporter_use

function oneshotteleporter_use($args)
{
    delete_item($args['id']);
    redirect("runmodule.php?module=oneshotteleporter");
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:5,代码来源:oneshotteleporter.php

示例14: COUNT

        return false;
    }
    $sql = "SELECT COUNT(*) FROM purch_order_details " . "WHERE item_code='{$stock_id}'";
    $result = db_query($sql, "could not query purchase orders");
    $myrow = db_fetch_row($result);
    if ($myrow[0] > 0) {
        display_error(tr('Cannot delete this item because there are existing ' . 'purchase order items for it.'));
        return false;
    }
    return true;
}
//------------------------------------------------------------------------------------
if (isset($_POST['delete']) && strlen($_POST['delete']) > 1) {
    if (can_delete($_POST['NewStockID'])) {
        $stock_id = $_POST['NewStockID'];
        delete_item($stock_id);
        meta_forward($_SERVER['PHP_SELF']);
    }
}
//------------------------------------------------------------------------------------
start_form(true);
if (db_has_stock_items()) {
    start_table("class='tablestyle_noborder'");
    start_row();
    stock_items_list_cells(tr("Select an item:"), 'stock_id', null, null, null, null, 1);
    submit_cells('SelectStockItem', tr("Edit Item"));
    end_row();
    end_table();
}
hyperlink_params($_SERVER['PHP_SELF'], tr("Enter a new item"), "New=1");
echo "<br>";
开发者ID:ravenii,项目名称:guardocs,代码行数:31,代码来源:items.php

示例15: hunterslodge_customarmour_run

function hunterslodge_customarmour_run()
{
    require_once "lib/sanitize.php";
    require_once "lib/names.php";
    global $session;
    $op = httpget("op");
    $free = httpget("free");
    $context = httpget("context");
    switch ($context) {
        case "village":
            $backlink = "village.php";
            break;
        case "forest":
            $backlink = "forest.php";
            break;
        case "worldmap":
            $backlink = "runmodule.php?module=worldmapen&op=continue";
            break;
        case "lodge":
            $backlink = "runmodule.php?module=iitems_hunterslodge&op=start";
            break;
    }
    page_header("Choose your Custom Armour");
    switch ($op) {
        case "change":
            output("Want to change your Custom Armour?  No problem.  Enter your desired armour in the box below.  You've got 25 characters to play around with.`n(leave this blank to disable custom armour naming and return to default, game-supplied armour names)`n`n");
            rawoutput("<form action='runmodule.php?module=hunterslodge_customarmour&op=confirm&free={$free}&context={$context}' method='POST'>");
            $armour = get_module_pref("customarmour");
            rawoutput("<input id='input' name='newarmour' width='25' maxlength='25' value='" . htmlentities($armour, ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "'>");
            rawoutput("<input type='submit' class='button' value='Preview'>");
            rawoutput("</form>");
            addnav("", "runmodule.php?module=hunterslodge_customarmour&op=confirm&free={$free}&context={$context}");
            addnav("Cancel");
            addnav("Don't set custom armour, just go back to where I came from", $backlink);
            break;
        case "confirm":
            $newarmour = httppost("newarmour");
            $sub = httpget("sub");
            $newarmour = str_replace("`", "", $newarmour);
            $newarmour = comment_sanitize($newarmour);
            $newarmour = substr($newarmour, 0, 25);
            if ($newarmour) {
                output("Your new custom armour is:`n%s`nWould you like to set your new armour now?`n`n", $newarmour);
            } else {
                output("You've chosen to go back to the default, game-supplied armours.  Are you sure that's what you want?`n`n");
            }
            addnav("Confirm");
            addnav("Set custom armour", "runmodule.php?module=hunterslodge_customarmour&op=set&free={$free}&context={$context}&newarmour=" . rawurlencode($newarmour));
            addnav("Cancel");
            addnav("Don't set custom armour, just go back to where I came from", $backlink);
            break;
        case "set":
            $newarmour = rawurldecode(httpget("newarmour"));
            if ($newarmour == "") {
                output("Your custom armour name has been removed.  The next time you change your armour, you'll return to game-supplied armour names.`n`n");
            } else {
                output("Your custom armour has been set to %s!`n`n", $newarmour);
                $session['user']['armor'] = $newarmour;
            }
            set_module_pref("customarmour", $newarmour);
            if (!$free) {
                require_once "modules/iitems/lib/lib.php";
                $id = has_item("hunterslodge_customarmour");
                delete_item($id);
            }
            addnav("Return");
            addnav("Return to where I came from", $backlink);
            break;
    }
    page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:71,代码来源:hunterslodge_customarmour.php


注:本文中的delete_item函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。