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


PHP httpset函数代码示例

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


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

示例1: handle_event

function handle_event($location, $baseLink = false, $needHeader = false)
{
    if ($baseLink === false) {
        global $PHP_SELF;
        $baseLink = substr($PHP_SELF, strrpos($PHP_SELF, "/") + 1) . "?";
    } else {
        //debug("Base link was specified as $baseLink");
        //debug(debug_backtrace());
    }
    global $session, $playermount, $badguy;
    $skipdesc = false;
    tlschema("events");
    $allowinactive = false;
    $eventhandler = httpget('eventhandler');
    if ($session['user']['superuser'] & SU_DEVELOPER && $eventhandler != "") {
        $allowinactive = true;
        $array = preg_split("/[:-]/", $eventhandler);
        if ($array[0] == "module") {
            $session['user']['specialinc'] = "module:" . $array[1];
        } else {
            $session['user']['specialinc'] = "";
        }
    }
    $_POST['i_am_a_hack'] = 'true';
    if ($session['user']['specialinc'] != "") {
        $specialinc = $session['user']['specialinc'];
        $session['user']['specialinc'] = "";
        if ($needHeader !== false) {
            page_header($needHeader);
        }
        output("`^`c`bSomething Special!`c`b`0");
        if (strchr($specialinc, ":")) {
            $array = split(":", $specialinc);
            $starttime = getmicrotime();
            module_do_event($location, $array[1], $allowinactive, $baseLink);
            $endtime = getmicrotime();
            if ($endtime - $starttime >= 1.0 && $session['user']['superuser'] & SU_DEBUG_OUTPUT) {
                debug("Slow Event (" . round($endtime - $starttime, 2) . "s): {$hookname} - {$row['modulename']}`n");
            }
        }
        if (checknavs()) {
            // The page rendered some linkage, so we just want to exit.
            page_footer();
        } else {
            $skipdesc = true;
            $session['user']['specialinc'] = "";
            $session['user']['specialmisc'] = "";
            httpset("op", "");
        }
    }
    tlschema();
    return $skipdesc;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:53,代码来源:events.php

示例2: elseif

            }
        } elseif ($key == "oldvalues") {
            //donothing.
        } elseif ($oldvalues[$key] != stripslashes($val) && isset($oldvalues[$key])) {
            $sql .= "{$key} = \"{$val}\",";
            $updates++;
            output("%s has changed to %s.`n", $key, stripslashes($val));
            debuglog($session['user']['name'] . "`0 changed {$key} to {$val}", $userid);
            if ($session['user']['acctid'] == $userid) {
                $session['user'][$key] = stripslashes($val);
            }
        }
    }
}
$sql = substr($sql, 0, strlen($sql) - 1);
$sql = "UPDATE " . db_prefix("accounts") . " SET " . $sql . " WHERE acctid=\"{$userid}\"";
$petition = httpget("returnpetition");
if ($petition != "") {
    addnav("", "viewpetition.php?op=view&id={$petition}");
}
addnav("", "user.php");
if ($updates > 0) {
    db_query($sql);
    debug("Updated {$updates} fields in the user record with:\n{$sql}");
    output("%s fields in the user's record were updated.", $updates);
} else {
    output("No fields were changed in the user's record.");
}
$op = "edit";
httpset($op, "edit");
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:30,代码来源:user_save.php

示例3: darkhorse_run

function darkhorse_run()
{
    $op = httpget('op');
    if ($op == "enter") {
        httpset("op", "tavern");
        page_header(get_module_setting("tavernname"));
        darkhorse_runevent("forest", "forest.php?");
        // Clear the specialinc, just in case.
        $session['user']['specialinc'] = "";
        page_footer();
    }
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:12,代码来源:darkhorse.php

示例4: riddles_editor

function riddles_editor()
{
    global $session;
    require_once "lib/nltoappon.php";
    if (!get_module_pref("canedit")) {
        check_su_access(SU_EDIT_RIDDLES);
    }
    $op = httpget('op');
    $id = httpget('id');
    page_header("Riddle Editor");
    require_once "lib/superusernav.php";
    superusernav();
    addnav("Riddle Editor");
    addnav("Riddle Editor Home", "runmodule.php?module=riddles&act=editor&admin=true");
    addnav("Add a riddle", "runmodule.php?module=riddles&act=editor&op=edit&admin=true");
    if ($op == "save") {
        $id = httppost('id');
        $riddle = trim(httppost('riddle'));
        $answer = trim(httppost('answer'));
        if ($id > "") {
            $sql = "UPDATE " . db_prefix("riddles") . " SET riddle='" . nltoappon($riddle) . "', answer='{$answer}' WHERE id='{$id}'";
        } else {
            $sql = "INSERT INTO " . db_prefix("riddles") . " (riddle,answer,author) VALUES('" . nltoappon($riddle) . "','{$answer}','{$session['user']['login']}')";
        }
        db_query($sql);
        if (db_affected_rows() > 0) {
            $op = "";
            httpset("op", "");
            output("Riddle saved.");
        } else {
            output("The query was not executed for some reason I can't fathom.");
            output("Perhaps you didn't actually make any changes to the riddle.");
        }
    } elseif ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("riddles") . " WHERE id='{$id}'";
        db_query($sql);
        $op = "";
        httpset("op", "");
        output("Riddle deleted.");
    }
    if ($op == "") {
        $sql = "SELECT * FROM " . db_prefix("riddles");
        $result = db_query($sql);
        $i = translate_inline("Id");
        $ops = translate_inline("Ops");
        $rid = translate_inline("Riddle");
        $ans = translate_inline("Answer");
        $auth = translate_inline("Author");
        rawoutput("<table border=0 cellpadding=2 cellspacing=1 bgcolor='#999999'><tr class='trhead'><td>{$i}</td><td>{$ops}</td><td>{$rid}</td><td>{$ans}</td><td>{$auth}</td></tr>");
        for ($i = 0; $i < db_num_rows($result); $i++) {
            $row = db_fetch_assoc($result);
            rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'>");
            rawoutput("<td valign='top'>");
            output_notl("%s", $row['id']);
            rawoutput("</td><td valign='top'>");
            $conf = translate_inline("Are you sure you wish to delete this riddle?");
            $edit = translate_inline("Edit");
            $del = translate_inline("Delete");
            $elink = "runmodule.php?module=riddles&act=editor&op=edit&id=" . $row['id'] . "&admin=true";
            $dlink = "runmodule.php?module=riddles&act=editor&op=del&id=" . $row['id'] . "&admin=true";
            output_notl("[");
            rawoutput("<a href='{$elink}'>{$edit}</a>");
            output_notl("|");
            rawoutput("<a href='{$dlink}' onClick='return confirm(\"{$conf}\");'>{$del}</a>");
            output_notl("]");
            addnav("", $elink);
            addnav("", $dlink);
            rawoutput("</td><td valign='top'>");
            output_notl("`&%s`0", $row['riddle']);
            rawoutput("</td><td valign='top'>");
            output_notl("`#%s`0", $row['answer']);
            rawoutput("</td><td valign='top'>");
            output_notl("`^%s`0", $row['author']);
            rawoutput("</td></tr>");
        }
        rawoutput("</table>");
    } elseif ($op == "edit") {
        $sql = "SELECT * FROM " . db_prefix("riddles") . " WHERE id='{$id}'";
        $result = db_query($sql);
        rawoutput("<form action='runmodule.php?module=riddles&act=editor&op=save&admin=true' method='POST'>", true);
        addnav("", "runmodule.php?module=riddles&act=editor&op=save&admin=true");
        if ($row = db_fetch_assoc($result)) {
            output("`bEdit a riddle`b`n");
            $title = "Edit a riddle";
            $i = $row['id'];
            rawoutput("<input type='hidden' name='id' value='{$i}'>");
        } else {
            output("`bAdd a riddle`b`n");
            $title = "Add a riddle";
            $row = array("riddle" => "", "answer" => "", "author" => $session['user']['login']);
        }
        $form = array("Riddle,title", "riddle" => "Riddle text,textarea", "answer" => "Answer", "author" => "Author,viewonly");
        require_once "lib/showform.php";
        showform($form, $row);
        rawoutput("</form>");
        output("`^NOTE:`& Separate multiple correct answers with semicolons (;)`n`n");
        output("`7The following are ignored at the start of answers: `&a, an, and, the, my, your, someones, someone's, someone, his, hers`n");
        output("`7The following are ignored at the end of answers: `&s, ing, ed`0`n`n");
        output("`\$NOTE:  Riddles are displayed in the language they are stored in the database.");
        output("Similarly, answers are expected in the language stored in the database.");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:riddles.php

示例5: worldmapen_run_real

function worldmapen_run_real()
{
    global $session, $badguy, $pvptimeout, $options, $outdoors, $shady;
    $outdoors = true;
    $op = httpget("op");
    $battle = false;
    if ($op == 'move' && rawurldecode(httpget('oloc')) != get_module_pref('worldXYZ')) {
        debug(get_module_pref('worldXYZ'));
        $op = 'continue';
        httpset('op', $op);
    }
    //	debug("Worldmap running op={$op} ...");
    // handle the admin editor first
    if ($op == "edit") {
        if (!get_module_pref("canedit")) {
            check_su_access(SU_EDIT_USERS);
        }
        if (get_module_setting("worldmapenInstalled") != 1) {
            set_module_setting('worldmapenInstalled', "1");
            worldmapen_defaultcityloc();
        }
        worldmapen_editor();
    }
    if ($op == "destination") {
        $cname = httpget("cname");
        $session['user']['location'] = $cname;
        addnav(array("Enter %s", $cname), "village.php");
        output("`c`4`bYou've Arrived in %s.`b`0`c`n", $cname);
        output("`cYou have reached the outer gates of the city.`c");
    }
    if (!get_module_setting("worldmapenInstalled")) {
        page_header("A rip in the fabric of space and time");
        require_once "lib/villagenav.php";
        villagenav();
        output("`^The admins of this game haven't yet finished installing the worldmapen module.");
        output("You should send them a petition and tell them that they forgot to generate the initial locations of the cities.");
        output("Until then, you are kind of stuck here, so I hope you like where you are.`n`n");
        output("After all, remember:`nWherever you go, there you are.`0");
        page_footer();
    }
    $subop = httpget("subop");
    $act = httpget("act");
    $type = httpget("type");
    $name = httpget("name");
    $direction = httpget("dir");
    $su = httpget("su");
    $buymap = httpget("buymap");
    $worldmapCostGold = get_module_setting("worldmapCostGold");
    $pvp = httpget('pvp');
    require_once "lib/events.php";
    if ($session['user']['specialinc'] != "" || httpget("eventhandler")) {
        $in_event = handle_event(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue&", "Travel");
        if ($in_event) {
            addnav("Continue", "runmodule.php?module=worldmapen&op=continue");
            module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
            page_footer();
        }
    }
    page_header("Journey");
    //is the player looking at chat?
    if (httpget('comscroll') || httpget('comscroll') === 0 || httpget('comment') || httpget('refresh')) {
        $chatoverride = 1;
        require_once "lib/commentary.php";
        addcommentary();
        $loc = get_module_pref("worldXYZ", "worldmapen");
        viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
    }
    if ($op == "beginjourney") {
        $loc = $session['user']['location'];
        $x = get_module_setting($loc . "X");
        $y = get_module_setting($loc . "Y");
        $z = get_module_setting($loc . "Z");
        $xyz = $x . "," . $y . "," . $z;
        set_module_pref("worldXYZ", $xyz);
        output("`b`&The gates of %s`& stand closed behind you.`0`b`n`n", $session['user']['location']);
        $num = e_rand(1, 5);
        $msg = get_module_setting("leaveGates{$num}");
        output("`c`n`^%s`0`n`c`n", $msg);
        worldmapen_determinenav();
        if (get_module_setting("smallmap")) {
            worldmapen_viewsmallmap();
        }
        if (!$chatoverride) {
            require_once "lib/commentary.php";
            addcommentary();
            $loc = get_module_pref("worldXYZ", "worldmapen");
            viewcommentary("mapchat-" . $loc, "Chat with others who walk this path...", 25);
        }
        worldmapen_viewmapkey(true, false);
        module_display_events(get_module_setting("randevent"), "runmodule.php?module=worldmapen&op=continue");
        $loc = get_module_pref('worldXYZ');
        list($x, $y, $z) = explode(",", $loc);
        $t = worldmapen_getTerrain($x, $y, $z);
        //debug($t);
        if ($t['type'] == "Forest") {
            $shady = true;
        }
    } elseif ($op == "continue") {
        checkday();
        worldmapen_determinenav();
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:run.php

示例6: str_replace

            $body = str_replace("\r", "\n", $body);
            $body = addslashes(substr(stripslashes($body), 0, (int) getsetting("mailsizelimit", 1024)));
            systemmail($row1['acctid'], $subject, $body, $session['user']['acctid']);
            output("Your message was sent!`n");
        }
    } else {
        output("Could not find the recipient, please try again.`n");
    }
    if (httppost("returnto") > "") {
        $op = "read";
        httpset('op', 'read');
        $id = httppost('returnto');
        httpset('id', $id);
    } else {
        $op = "";
        httpset('op', "");
    }
}
if ($op == "") {
    output("`b`iMail Box`i`b");
    if (isset($session['message'])) {
        output($session['message']);
    }
    $session['message'] = "";
    $sql = "SELECT subject,messageid," . db_prefix("accounts") . ".name,msgfrom,seen,sent FROM " . db_prefix("mail") . " LEFT JOIN " . db_prefix("accounts") . " ON " . db_prefix("accounts") . ".acctid=" . db_prefix("mail") . ".msgfrom WHERE msgto=\"" . $session['user']['acctid'] . "\" ORDER BY sent DESC";
    $result = db_query($sql);
    if (db_num_rows($result) > 0) {
        output_notl("<form action='mail.php?op=process' method='POST'><table>", true);
        for ($i = 0; $i < db_num_rows($result); $i++) {
            $row = db_fetch_assoc($result);
            if ((int) $row['msgfrom'] == 0) {
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:mail.php

示例7: httpset

        $op = "";
        httpset("op", $op);
    } else {
        if ($op == "save") {
            $weaponid = (int) httppost("weaponid");
            $damage = httppost("damage");
            $weaponname = httppost("weaponname");
            if ($weaponid > 0) {
                $sql = "UPDATE " . db_prefix("weapons") . " SET weaponname=\"{$weaponname}\",damage=\"{$damage}\",value=" . $values[$damage] . " WHERE weaponid='{$weaponid}'";
            } else {
                $sql = "INSERT INTO " . db_prefix("weapons") . " (level,damage,weaponname,value) VALUES ({$weaponlevel},\"{$damage}\",\"{$weaponname}\"," . $values[$damage] . ")";
            }
            db_query($sql);
            //output($sql);
            $op = "";
            httpset("op", $op);
        }
    }
}
if ($op == "") {
    $sql = "SELECT max(level+1) as level FROM " . db_prefix("weapons");
    $res = db_query($sql);
    $row = db_fetch_assoc($res);
    $max = $row['level'];
    for ($i = 0; $i <= $max; $i++) {
        if ($i == 1) {
            addnav("Weapons for 1 DK", "weaponeditor.php?level={$i}");
        } else {
            addnav(array("Weapons for %s DKs", $i), "weaponeditor.php?level={$i}");
        }
    }
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:weaponeditor.php

示例8: httpget

<?php

//save module settings.
$userid = httpget('userid');
$module = httpget('module');
$post = httpallpost();
$post = modulehook("validateprefs", $post, true, $module);
if (isset($post['validation_error']) && $post['validation_error']) {
    tlschema("module-{$module}");
    $post['validation_error'] = translate_inline($post['validation_error']);
    tlschema();
    output("Unable to change settings: `\$%s`0", $post['validation_error']);
} else {
    reset($post);
    while (list($key, $val) = each($post)) {
        output("Setting %s to %s`n", $key, stripslashes($val));
        $sql = "REPLACE INTO " . db_prefix("module_userprefs") . " (modulename,userid,setting,value) VALUES ('{$module}','{$userid}','{$key}','{$val}')";
        db_query($sql);
    }
    output("`^Preferences for module %s saved.`n", $module);
}
$op = "edit";
httpset("op", "edit");
httpset("subop", "module", true);
开发者ID:stephenKise,项目名称:Legend-of-the-Green-Dragon,代码行数:24,代码来源:user_savemodule.php

示例9: db_query

    db_query($sql);
    output('`6The item "`^%s`6" has been successfully edited.`n`n', $displayname);
    if (getsetting('usedatacache', false) && $cat != $postcat) {
        $cat = (int) $cat;
        require_once './modules/mysticalshop/libcoredup.php';
        invalidatedatacache('modules-mysticalshop-view-' . $cat);
        mysticalshop_massinvalidate('modules-mysticalshop-viewgoods-' . $cat);
    }
} else {
    $sql = 'LOCK TABLES ' . db_prefix('magicitems') . ' WRITE;';
    db_query($sql);
    $sql = "INSERT INTO " . db_prefix("magicitems") . "\r\n\t(category,name,description,gold,gems,dk,attack,defense,charm,hitpoints,turns,favor,bigdesc,rare,rarenum)\r\n\tVALUES ({$postcat},'{$name}','{$describe}',{$gold},{$gems},{$dk},{$attack},{$defense},{$charm},{$hitpoints},{$turns},{$favor},'{$bigdesc}',{$rare},{$rarenum})";
    db_query($sql);
    $itemid = db_insert_id();
    $sql = 'UNLOCK TABLES;';
    db_query($sql);
    output('`6The item "`^%s`6" has been saved to the database.`n`n', $displayname);
}
output('Would you like to <a href="' . htmlentities($fromeditor . 'preview&id=' . $itemid . '&cat=') . $postcat . '">[ Review ]</a> or <a href="' . htmlentities($fromeditor . 'edit&id=' . $itemid . '&cat=') . $postcat . '">[ Edit ]</a> this item?`0', true);
addnav('', $fromeditor . 'edit&id=' . $itemid . '&cat=' . $postcat);
addnav('', $fromeditor . 'preview&id=' . $itemid . '&cat=' . $postcat);
if (getsetting('usedatacache', false)) {
    invalidatedatacache('modules-mysticalshop-editorcats');
    invalidatedatacache('modules-mysticalshop-view-' . $postcat);
    invalidatedatacache('modules-mysticalshop-enter');
    require_once './modules/mysticalshop/libcoredup.php';
    mysticalshop_massinvalidate('modules-mysticalshop-viewgoods-' . $postcat);
}
httpset('id', $itemid);
httpset('cat', $postcat);
$cat = $postcat;
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:save.php

示例10: lottery_run

function lottery_run()
{
    global $session;
    $op = httpget("op");
    $cost = get_module_setting("ticketcost");
    $numbers = get_module_setting("todaysnumbers");
    $n = $numbers;
    $prize = get_module_setting("prize");
    $prizecount = get_module_setting("howmany");
    $jackpot = (int) get_module_setting("currentjackpot");
    $bleed = (int) get_module_setting("percentbleed");
    $roundnum = (int) get_module_setting("roundnum");
    $msg = "";
    if ($op == "buy") {
        $op = "store";
        httpset("op", $op);
        if ($session['user']['gold'] >= $cost) {
            $lotto = httppost("lotto");
            if ($lotto) {
                sort($lotto);
                set_module_pref("pick", join("", $lotto));
                set_module_pref("roundnum", $roundnum);
                $session['user']['gold'] -= $cost;
                debuglog("spent {$cost} on a lottery ticket");
                $jackpot += round($cost * (100 - $bleed) / 100, 0);
                set_module_setting("currentjackpot", $jackpot);
            } else {
                $msg = translate_inline("`\$You seem to have mumbled when you requested the lottery tickets.  Please restate your numbers.`0`n`n");
            }
        } else {
            $msg = translate_inline("`\$You do not have enough to buy a lottery ticket!`0`n`n");
        }
    }
    if ($op == "store") {
        require_once "lib/villagenav.php";
        page_header("%s's Lottery", getsetting("barkeep", "`tCedrik"));
        output("Today's lottery numbers are `^%s-%s-%s-%s`7.", $n[0], $n[1], $n[2], $n[3]);
        output("The jackpot is now up to `^%s`0 gold!`n`n", $jackpot);
        if ($prize > 0) {
            if ($prizecount == 1) {
                output("The winner of the last jackpot got `^%s`0 gold!`n`n", $prize);
            } else {
                output("The %s winners of the last jackpot each got `^%s`0 gold!`n`n", $prizecount, $prize);
            }
        } else {
            output("There were no recent jackpot winners!`n`n");
        }
        $pick = get_module_pref("pick");
        if ($pick > "") {
            $n = $pick;
            output("You bought a lottery ticket for tomorrow's drawing; the numbers you chose are: `^%s-%s-%s-%s`7`n`n", $n[0], $n[1], $n[2], $n[3]);
        } else {
            output("%s", $msg);
            output("Lottery tickets cost `^%s`0 gold.", $cost);
            output("If you would like to buy one for tomorrow's drawing, please choose your numbers below and click \"Buy\".");
            rawoutput("<form action='runmodule.php?module=lottery&op=buy' method='POST'>", true);
            addnav("", "runmodule.php?module=lottery&op=buy");
            for ($i = 0; $i < 4; $i++) {
                $j = $i + 1;
                if ($j == 4) {
                    $k = "buy";
                } else {
                    $k = $j + 1;
                }
                rawoutput("<select id='lotto{$j}' name='lotto[{$i}]' onChange='document.getElementById(\"lotto{$k}\").focus()'>");
                for ($x = 0; $x < 10; $x++) {
                    rawoutput("<option value='{$x}'>{$x}</option>");
                }
                rawoutput("</select>");
            }
            $b = translate_inline("Buy");
            rawoutput("<input type='submit' class='button' value='{$b}' id='lottobuy'>");
            rawoutput("</form>");
            rawoutput("<script language='JavaScript'>document.getElementById('lotto1').focus();</script>");
        }
        output("A drawing is held at the start of each game day.");
        output("If the numbers you chose match, in any order, you win the jackpot for the day!");
        output("If no one matches the jackpot on a particular day, the sum will roll over for the following game day.");
        output("A portion of the proceeds of the lottery go to help injured forest creatures.");
        addnav("Return");
        addnav("I?Return to the Inn", "inn.php");
        villagenav();
        page_footer();
    }
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:85,代码来源:lottery.php

示例11: claneditor_run


//.........这里部分代码省略.........
                $sql = "SELECT name,acctid,clanrank FROM " . db_prefix("accounts") . " WHERE clanid={$dt} ORDER BY clanrank DESC, clanjoindate";
                $result = db_query($sql);
                $row = db_fetch_assoc($result);
                $sql = "UPDATE " . db_prefix("accounts") . " SET clanrank=" . CLAN_LEADER . " WHERE acctid='" . $row['acctid'] . "'";
                db_query($sql);
                output_notl($noleader, $row['name']);
            }
            // end collapse
            modulehook("}collapse");
        } elseif ($op == "deleteclan") {
            if (httpget("sop") == "yes") {
                //notify users of the deletion of the clan
                $sql = "SELECT acctid FROM " . db_prefix("accounts") . " WHERE clanid={$dt}";
                $result = db_query($sql);
                $subj = array("Deletion of %s", $claninfo['clanname']);
                $msg = array("The clan you were in, %s, has closed its doors.\nSorry for any inconvenience.", $claninfo['clanname']);
                while ($row = db_fetch_assoc($result)) {
                    systemmail($row['acctid'], $subj, $msg);
                }
                //change the clan if a user is in this clan
                $sql = "UPDATE " . db_prefix("accounts") . " SET clanid=0,clanrank=" . CLAN_APPLICANT . ",clanjoindate='0000-00-00 00:00:00' WHERE clanid={$dt}";
                db_query($sql);
                //change the current users clan if this user was in that clan
                if ($session['user']['clanid'] == $dt) {
                    $session['user']['clanid'] = 0;
                    $session['user']['clanrank'] = CLAN_APPLICANT;
                    $session['user']['clanjoindate'] = '0000-00-00 00:00:00';
                }
                //drop the clan.
                $sql = "DELETE FROM " . db_prefix("clans") . " WHERE clanid={$dt}";
                db_query($sql);
                module_delete_objprefs('clans', $dt);
                $op = "";
                httpset("op", "");
                unset($claninfo);
                $dt = "";
                output("That clan has been wiped.`n");
                output("`@Users within the clan have been notified.");
            } else {
                output("`%`c`bAre you SURE you want to delete this clan?`b`c`n");
                $dc = translate_inline("Delete this clan? Are you sure!");
                rawoutput("[<a href='runmodule.php?module=claneditor&op=deleteclan&sop=yes&dt={$dt}' onClick='return confirm(\"{$dc}\");'>{$dc}</a>]");
                addnav("", "runmodule.php?module=claneditor&op=deleteclan&sop=yes&dt={$dt}");
            }
        } elseif ($op == "editmodule" || $op == "editmodulesave") {
            $mdule = httpget("mdule");
            if ($op == "editmodulesave") {
                // Save module prefs
                $post = httpallpost();
                reset($post);
                while (list($key, $val) = each($post)) {
                    set_module_objpref("clans", $dt, $key, $val, $mdule);
                }
                output("`^Saved!`0`n");
            }
            rawoutput("<form action='runmodule.php?module=claneditor&op=editmodulesave&dt={$dt}&mdule={$mdule}' method='POST'>");
            module_objpref_edit("clans", $mdule, $dt);
            rawoutput("</form>");
            addnav("", "runmodule.php?module=claneditor&op=editmodulesave&dt={$dt}&mdule={$mdule}");
        } elseif ($op == "updinfo") {
            page_header("Update Clan Information");
            $clanmotd = substr(httppost('clanmotd'), 0, 4096);
            if (httppostisset('clanmotd') && $clanmotd != $claninfo['clanmotd']) {
                if ($clanmotd == "") {
                    $mauthor = 0;
                } else {
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:67,代码来源:claneditor.php

示例12: db_prefix

     }
     $sql = "SELECT login,name,superuser FROM " . db_prefix("accounts") . " WHERE name LIKE '" . addslashes($string) . "' AND locked=0 ORDER by login='{$to}' DESC, name='{$to}' DESC, login";
     $result = db_query($sql);
     $db_num_rows = db_num_rows($result);
 }
 if ($db_num_rows == 1) {
     $row = db_fetch_assoc($result);
     output_notl("<input type='hidden' id='to' name='to' value=\"" . htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">", true);
     output_notl("`^{$row['name']}`n");
     if ($row['superuser'] & SU_GIVES_YOM_WARNING && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
         array_push($superusers, $row['login']);
     }
 } elseif ($db_num_rows == 0) {
     output("`\$No one was found who matches \"%s\".`n", stripslashes($to));
     output("`@Please try again.`n");
     httpset('prepop', $to, true);
     rawoutput("</form>");
     require "lib/mail/case_address.php";
     popup_footer();
 } else {
     output_notl("<select name='to' id='to' onchange='check_su_warning();'>", true);
     $superusers = array();
     while ($row = db_fetch_assoc($result)) {
         output_notl("<option value=\"" . htmlentities($row['login'], ENT_COMPAT, getsetting("charset", "ISO-8859-1")) . "\">", true);
         require_once "lib/sanitize.php";
         output_notl("%s", full_sanitize($row['name']));
         if ($row['superuser'] & SU_GIVES_YOM_WARNING && !($row['superuser'] & SU_OVERRIDE_YOM_WARNING)) {
             array_push($superusers, $row['login']);
         }
     }
     output_notl("</select>`n", true);
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:case_write.php

示例13: drinks_editor

function drinks_editor()
{
    global $mostrecentmodule;
    if (!get_module_pref("canedit")) {
        check_su_access(SU_EDIT_USERS);
    }
    page_header("Drink Editor");
    require_once "lib/superusernav.php";
    superusernav();
    addnav("Drink Editor");
    addnav("Add a drink", "runmodule.php?module=drinks&act=editor&op=add&admin=true");
    $op = httpget('op');
    $drinkid = httpget('drinkid');
    $header = "";
    if ($op != "") {
        addnav("Drink Editor Main", "runmodule.php?module=drinks&act=editor&admin=true");
        if ($op == 'add') {
            $header = translate_inline("Adding a new drink");
        } else {
            if ($op == 'edit') {
                $header = translate_inline("Editing a drink");
            }
        }
    } else {
        $header = translate_inline("Current drinks");
    }
    output_notl("`&<h3>{$header}`0</h3>", true);
    $drinksarray = array("Drink,title", "drinkid" => "Drink ID,hidden", "name" => "Drink Name", "costperlevel" => "Cost per level,int", "hpchance" => "Chance of modifying HP (see below),range,0,10,1", "turnchance" => "Chance of modifying turns (see below),range,0,10,1", "alwayshp" => "Always modify hitpoints,bool", "alwaysturn" => "Always modify turns,bool", "drunkeness" => "Drunkeness,range,1,100,1", "harddrink" => "Is drink hard alchohol?,bool", "hpmin" => "Min HP to add (see below),range,-20,20,1", "hpmax" => "Max HP to add (see below),range,-20,20,1", "hppercent" => "Modify HP by some percent (see below),range,-25,25,5", "turnmin" => "Min turns to add (see below),range,-5,5,1", "turnmax" => "Max turns to add (see below),range,-5,5,1", "remarks" => "Remarks", "buffname" => "Name of the buff", "buffrounds" => "Rounds buff lasts,range,1,20,1", "buffroundmsg" => "Message each round of buff", "buffwearoff" => "Message when buff wears off", "buffatkmod" => "Attack modifier of buff", "buffdefmod" => "Defense modifier of buff", "buffdmgmod" => "Damage modifier of buff", "buffdmgshield" => "Damage shield modifier of buff", "buffeffectfailmsg" => "Effect failure message (see below)", "buffeffectnodmgmsg" => "No damage message (see below)", "buffeffectmsg" => "Effect message (see below)");
    if ($op == "del") {
        $sql = "DELETE FROM " . db_prefix("drinks") . " WHERE drinkid='{$drinkid}'";
        module_delete_objprefs('drinks', $drinkid);
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "save") {
        $subop = httpget("subop");
        if ($subop == "") {
            $drinkid = httppost("drinkid");
            list($sql, $keys, $vals) = postparse($drinksarray);
            if ($drinkid > 0) {
                $sql = "UPDATE " . db_prefix("drinks") . " SET {$sql} WHERE drinkid='{$drinkid}'";
            } else {
                $sql = "INSERT INTO " . db_prefix("drinks") . " ({$keys}) VALUES ({$vals})";
            }
            db_query($sql);
            if (db_affected_rows() > 0) {
                output("`^Drink saved!");
            } else {
                $str = db_error();
                if ($str == "") {
                    output("`^Drink not saved: no changes detected.");
                } else {
                    output("`^Drink not saved: `\$%s`0", $sql);
                }
            }
        } elseif ($subop == "module") {
            $drinkid = httpget("drinkid");
            // Save module settings
            $module = httpget("editmodule");
            // This should obey the same rules as the configuration editor
            // So disabling
            //$sql = "DELETE FROM " . db_prefix("module_objprefs") . " WHERE objtype='drinks' AND objid='$drinkid' AND modulename='$module'";
            //db_query($sql);
            $post = httpallpost();
            reset($post);
            while (list($key, $val) = each($post)) {
                set_module_objpref("drinks", $drinkid, $key, $val, $module);
            }
            output("`^Saved.");
        }
        if ($drinkid) {
            $op = "edit";
            httpset("drinkid", $drinkid, true);
        } else {
            $op = "";
        }
        httpset('op', $op);
    }
    if ($op == "activate") {
        $sql = "UPDATE " . db_prefix("drinks") . " SET active=1 WHERE drinkid='{$drinkid}'";
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "deactivate") {
        $sql = "UPDATE " . db_prefix("drinks") . " SET active=0 WHERE drinkid='{$drinkid}'";
        db_query($sql);
        $op = "";
        httpset('op', "");
    }
    if ($op == "") {
        $op = translate_inline("Ops");
        $id = translate_inline("Id");
        $nm = translate_inline("Name");
        $dkn = translate_inline("Drunkeness");
        $hard = translate_inline("Hard Alchohol?");
        $edit = translate_inline("Edit");
        $deac = translate_inline("Deactivate");
        $act = translate_inline("Activate");
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:misc_functions.php

示例14: cities_run

function cities_run()
{
    global $session;
    $op = httpget("op");
    $city = urldecode(httpget("city"));
    $continue = httpget("continue");
    $danger = httpget("d");
    $su = httpget("su");
    if ($op != "faq") {
        require_once "lib/forcednavigation.php";
        do_forced_nav(false, false);
    }
    // I really don't like this being out here, but it has to be since
    // events can define their own op=.... and we might need to handle them
    // otherwise things break.
    require_once "lib/events.php";
    if ($session['user']['specialinc'] != "" || httpget("eventhandler")) {
        $in_event = handle_event("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1&", "Travel");
        if ($in_event) {
            addnav("Continue", "runmodule.php?module=cities&op=travel&city=" . urlencode($city) . "&d={$danger}&continue=1");
            module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
            page_footer();
        }
    }
    if ($op == "travel") {
        $args = modulehook("count-travels", array('available' => 0, 'used' => 0));
        $free = max(0, $args['available'] - $args['used']);
        if ($city == "") {
            require_once "lib/villagenav.php";
            page_header("Travel");
            //modulehook("collapse{", array("name"=>"traveldesc"));
            output("`%Travelling the world can be a dangerous occupation.");
            output("Although other villages might offer things not found in your current one, getting from village to village is no easy task, and might subject you to various dangerous creatures or brigands.");
            output("Be sure you're willing to take on the adventure before you set out, as not everyone arrives at their destination intact.");
            output("Also, pay attention to the signs, some roads are safer than others.`n");
            //modulehook("}collapse");
            addnav("Forget about it");
            villagenav();
            modulehook("pre-travel");
            if (!($session['user']['superuser'] & SU_EDIT_USERS) && $session['user']['turns'] <= 0 && $free == 0) {
                // this line rewritten so as not to clash with the hitch module.
                output("`nYou don't feel as if you could face the prospect of walking to another city today, it's far too exhausting.`n");
            } else {
                addnav("Travel");
                modulehook("travel");
            }
            module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
            page_footer();
        } else {
            if ($continue != "1" && $su != "1" && !get_module_pref("paidcost")) {
                set_module_pref("paidcost", 1);
                if ($free > 0) {
                    // Only increment travel used if they are still within
                    // their allowance.
                    set_module_pref("traveltoday", get_module_pref("traveltoday") + 1);
                    //do nothing, they're within their travel allowance.
                } elseif ($session['user']['turns'] > 0) {
                    $session['user']['turns']--;
                } else {
                    output("Hey, looks like you managed to travel with out having any forest fights.  How'd you swing that?");
                    debuglog("Travelled with out having any forest fights, how'd they swing that?");
                }
            }
            // Let's give the lower DK people a slightly better chance.
            $dlevel = cities_dangerscale($danger);
            if (e_rand(0, 100) < $dlevel && $su != '1') {
                //they've been waylaid.
                if (module_events("travel", get_module_setting("travelspecialchance"), "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1&") != 0) {
                    page_header("Something Special!");
                    if (checknavs()) {
                        page_footer();
                    } else {
                        // Reset the special for good.
                        $session['user']['specialinc'] = "";
                        $session['user']['specialmisc'] = "";
                        $skipvillagedesc = true;
                        $op = "";
                        httpset("op", "");
                        addnav("Continue", "runmodule.php?module=cities&op=travel&city=" . urlencode($city) . "&d={$danger}&continue=1");
                        module_display_events("travel", "runmodule.php?module=cities&city=" . urlencode($city) . "&d={$danger}&continue=1");
                        page_footer();
                    }
                }
                $args = array("soberval" => 0.9, "sobermsg" => "`&Facing your bloodthirsty opponent, the adrenaline rush helps to sober you up slightly.", "schema" => "module-cities");
                modulehook("soberup", $args);
                require_once "lib/forestoutcomes.php";
                $sql = "SELECT * FROM " . db_prefix("creatures") . " WHERE creaturelevel = '{$session['user']['level']}' AND forest = 1 ORDER BY rand(" . e_rand() . ") LIMIT 1";
                $result = db_query($sql);
                restore_buff_fields();
                if (db_num_rows($result) == 0) {
                    // There is nothing in the database to challenge you,
                    // let's give you a doppleganger.
                    $badguy = array();
                    $badguy['creaturename'] = "An evil doppleganger of " . $session['user']['name'];
                    $badguy['creatureweapon'] = $session['user']['weapon'];
                    $badguy['creaturelevel'] = $session['user']['level'];
                    $badguy['creaturegold'] = 0;
                    $badguy['creatureexp'] = round($session['user']['experience'] / 10, 0);
                    $badguy['creaturehealth'] = $session['user']['maxhitpoints'];
                    $badguy['creatureattack'] = $session['user']['attack'];
//.........这里部分代码省略.........
开发者ID:Beeps,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:cities.php

示例15: jewelmonster_runevent

function jewelmonster_runevent($type, $link)
{
    global $session;
    $op = httpget('op');
    $session['user']['specialinc'] = "module:jewelmonster";
    $battle = false;
    switch ($op) {
        case "":
        case "search":
            $count = 0;
            if (is_module_active("jeweler")) {
                $count = get_module_pref("totalheld", "jeweler");
            }
            output("`3While searching for gems and gold, you feel a shadow fall upon you.");
            output("With a terrible sense of foreboding, you raise your head.");
            output("The creature before your eyes terrifies you to the bone.");
            output("`3From a scaly neck emerges the %s's head of horror, huge tusks leaning towards you in a menacing manner.`n`n", translate_inline(get_module_setting("name")));
            if ($count > 0) {
                output("Catching sight of your jeweled adornments, it rears back for a moment, before moving towards you once again and snarling.");
            }
            output("`3Snakes in its hair tell you this fight is very real, and you had best prepare!");
            addnav("Fight", $link . "op=pre");
            break;
        case "pre":
            $op = "fight";
            httpset("op", $op);
            $count = 0;
            if (is_module_active("jeweler")) {
                $count = get_module_pref("totalheld", "jeweler");
            }
            if ($session['user']['dragonkills'] <= get_module_setting("dk")) {
                $count += get_module_setting("grace");
            }
            $hpl = get_module_setting("hploss") * $count;
            if ($count == $session['user']['dragonkills'] || $count == 10) {
                $monhp = round($session['user']['maxhitpoints'] + 10) - $hpl;
                $monatk = $session['user']['attack'] * 1.1;
                $mondef = $session['user']['defense'] * 1.1;
            } else {
                $monhp = round($session['user']['maxhitpoints'] + 40) - $hpl;
                $monatk = round($session['user']['attack']) * 1.2;
                $mondef = round($session['user']['defense']) * 1.2;
            }
            # if we have a too small hp, just set it to something more reasonable.
            if ($monhp < 10) {
                $monhp = $session['user']['maxhitpoints'] + $hpl / 2;
            }
            // even out his strength a bit
            $badguylevel = $session['user']['level'] + 1;
            if ($session['user']['level'] > 9) {
                $monhp *= 1.05;
            }
            if ($session['user']['level'] < 4) {
                $badguylevel--;
            }
            $badguy = array("creaturename" => translate_inline(get_module_setting("name")), "creatureweapon" => translate_inline("Beak of Doom"), "creaturelevel" => $badguylevel, "creaturehealth" => round($monhp), "creatureattack" => $monatk, "creaturedefense" => $mondef, "noadjust" => 1, "diddamage" => 0, "type" => "jewelmonster");
            $session['user']['badguy'] = createstring($badguy);
            break;
    }
    if ($op == "fight") {
        $battle = true;
    }
    if ($battle) {
        include "battle.php";
        if ($victory) {
            output("`n`n`3You have overcome %s!", translate_inline(get_module_setting("name")));
            if (get_module_pref("totalheld", "jeweler") > 0) {
                output("Your jewelry burns your skin, as if to remind you of your narrow escape.`n`n");
            }
            output("You aren't waiting around to see if it is dead or just resting!`n`n");
            if ($session['user']['hitpoints'] <= 0) {
                output("`n`n`^With the last of your energy, you press a piece of cloth to your wounds, stopping your bloodloss before you are completely dead.`n");
                $session['user']['hitpoints'] = 1;
            }
            $exp = round($session['user']['experience'] * get_module_setting("expgain"));
            // even out the gain a bit... it was too huge at the top and pathetic at the bottom
            if ($session['user']['level'] > 9) {
                $exp *= 0.8;
            }
            if ($session['user']['level'] < 6) {
                $exp *= 1.2;
            }
            if ($session['user']['level'] == 1) {
                $exp += 20;
            }
            // to stop people sometimes gaining 2 xp
            $exp = round($exp);
            output("`3The fight earns you `^%s `3experience.`0", $exp);
            $session['user']['experience'] += round($exp);
            $badguy = array();
            $session['user']['badguy'] = "";
            $session['user']['specialinc'] = "";
        } elseif ($defeat) {
            $badguy = array();
            $session['user']['badguy'] = "";
            $session['user']['specialinc'] = "";
            output("`n`n`3With one final crushing blow, %s pins you to the ground.", translate_inline(get_module_setting("name")));
            if ($session['user']['gold'] > 10) {
                output("While you lie there, helpless, its snake hair extricates some of your gold.");
                $lost = round($session['user']['gold'] * 0.2, 0);
//.........这里部分代码省略.........
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:101,代码来源:jewelmonster.php


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