本文整理汇总了PHP中db_prefix函数的典型用法代码示例。如果您正苦于以下问题:PHP db_prefix函数的具体用法?PHP db_prefix怎么用?PHP db_prefix使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了db_prefix函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: ekd_dohook
function ekd_dohook($hookname, $args)
{
global $session;
switch ($hookname) {
case "biostat":
$acctid = $args['acctid'];
$sql = "SELECT dragonkills FROM " . db_prefix("accounts") . " WHERE acctid = {$acctid}";
$result = db_fetch_assoc(db_query($sql));
$tdk = $result['dragonkills'];
$edk = get_module_pref("edks", "edk", $acctid);
$cdk = $tdk - $edk;
if ($edk > 1 && $tdk > 1) {
output("Out of %s total Drive Kills, %s were Economic Drive Kills.`n", $tdk, $edk);
} else {
if ($edk == 1) {
output("This player has completed an Economic Drive Kill.`n");
}
}
break;
case "counciloffices":
addnav("Ask about the Gun", "runmodule.php?module=edk&op=start");
break;
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:25,代码来源:edk.php
示例2: dag_uninstall
function dag_uninstall()
{
output("Dropping bounty table");
$sql = "DROP TABLE IF EXISTS " . db_prefix("bounty");
db_query($sql);
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:7,代码来源:dag.php
示例3: friendlist_unignore
function friendlist_unignore()
{
global $session;
$ac = httpget('ac');
$ignored = rexplode(get_module_pref('ignored', 'friendlist', $ac));
$iveignored = rexplode(get_module_pref('iveignored'));
if (in_array($ac, $iveignored)) {
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid={$ac} AND locked=0";
$result = db_query($sql);
if (db_num_rows($result) > 0) {
$row = db_fetch_assoc($result);
$info = sprintf_translate("%s`Q has been removed from your list.", $row['name']);
require_once "lib/systemmail.php";
$t = array("`\$Ignore List Removal");
$mailmessage = array("%s`0`@ has removed you from %s ignore list.", $session['user']['name'], $session['user']['sex'] ? translate_inline("her") : translate_inline("his"));
systemmail($ac, $t, $mailmessage);
} else {
$info = translate_inline("That user no longer exists...");
}
}
$ignored = array_diff($ignored, array($session['user']['acctid']));
$ignored = rimplode($ignored);
set_module_pref('ignored', $ignored, 'friendlist', $ac);
if (in_array($ac, $iveignored)) {
$iveignored = array_diff($iveignored, array($ac));
$iveignored = rimplode($iveignored);
set_module_pref('iveignored', $iveignored);
}
output_notl($info);
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:30,代码来源:friendlist_unignore.php
示例4: viewcommentaryargs_dohook
function viewcommentaryargs_dohook($hook, $args)
{
global $currentCommentaryArea;
switch ($hook) {
case 'blockcommentarea':
$currentCommentaryArea = $args['section'];
break;
case 'viewcommentary':
$accounts = db_prefix('accounts');
$commentary = db_prefix('commentary');
preg_match("/bio.php\\?char=(.*)&ret/", $args['commentline'], $matches);
$acctid = filter_var($matches[1], FILTER_SANITIZE_NUMBER_INT);
$sql = db_query_cached("SELECT login, name FROM {$accounts} WHERE acctid = {$acctid}", "commentary-author_name-{$acctid}", 86400);
$row = db_fetch_assoc($sql);
$name = $row['name'];
$login = $row['login'];
$temp = explode($row['name'], $args['commentline']);
$temp = str_replace('`3 says, "`#', '', $temp[1]);
$temp = str_replace('`3"', '', $temp);
$temp = str_replace('/me', '', $temp);
$temp = str_replace(':', '', $temp);
$temp = str_replace('</a>', '', $temp);
$temp = full_sanitize($temp);
$temp = addslashes(implode('%', str_split(trim($temp))));
$sql = db_query("SELECT commentid, comment, postdate FROM {$commentary}\n WHERE comment LIKE '%{$temp}%'\n AND section = '{$currentCommentaryArea}'");
$row = db_fetch_assoc($sql);
$args = ['commentline' => $args['commentline'], 'section' => $currentCommentaryArea, 'commentid' => $row['commentid'], 'comment' => $row['comment'], 'author_acctid' => $acctid, 'author_login' => $login, 'author_name' => $name, 'date' => $row['postdate']];
unset($row);
unset($temp);
break;
}
return $args;
}
示例5: bugtracker_install
function bugtracker_install()
{
$bugs = array('id' => array('name' => 'creatureid', 'type' => 'int(11) unsigned', 'extra' => 'auto_increment'), 'status' => array('name' => 'status', 'type' => 'text'), 'public' => array('name' => 'public', 'type' => 'bool'), 'info' => array('name' => 'info', 'type' => 'text'), 'key-PRIMARY' => array('name' => 'PRIMARY', 'type' => 'primary key', 'unique' => '1', 'columns' => 'id'));
require_once "lib/tabledescriptor.php";
synctable(db_prefix('bugs'), $bugs, true);
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:7,代码来源:bugtracker.php
示例6: friendlist_search
function friendlist_search()
{
global $session;
$n = httppost("n");
rawoutput("<form action='runmodule.php?module=friendlist&op=search' method='POST'>");
addnav("", "runmodule.php?module=friendlist&op=search");
if ($n != "") {
$string = "%";
for ($x = 0; $x < strlen($n); $x++) {
$string .= substr($n, $x, 1) . "%";
}
$sql = "SELECT name,dragonkills,acctid FROM " . db_prefix("accounts") . " WHERE name LIKE '%{$string}%' AND acctid<>" . $session['user']['acctid'] . " AND locked=0 ORDER BY level,dragonkills";
$result = db_query($sql);
if (db_num_rows($result) > 0) {
$ignored = rexplode(get_module_pref('ignored'));
$friends = rexplode(get_module_pref('friends'));
$request = rexplode(get_module_pref('request'));
$iveignored = rexplode(get_module_pref('iveignored'));
output("`@These users were found:`n");
rawoutput("<table style='width:60%;text-align:center;' cellpadding='3' cellspacing='0' border='0'>");
rawoutput("<tr class='trhead'><td>" . translate_inline("Name") . "</td><td>" . translate_inline("Operations") . "</td></tr>");
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
rawoutput("<tr class='" . ($i % 2 ? "trlight" : "trdark") . "'><td>");
output_notl($row['name']);
rawoutput("</td><td>");
if (in_array($row['acctid'], $ignored)) {
$info = translate_inline("This user has ignored you.");
$info .= " [<a href='runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Ignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid']);
} elseif (in_array($row['acctid'], $friends)) {
$info = translate_inline("This user is already in your list.");
} elseif (in_array($row['acctid'], $request)) {
$info = translate_inline("This user has already requested to you.");
} else {
if (in_array($row['acctid'], $iveignored)) {
$info = "[<a href='runmodule.php?module=friendlist&op=unignore&ac=" . $row['acctid'] . "' class='colLtRed'>" . translate_inline("Unignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=unignore&ac=" . $row['acctid']);
} else {
$info = "[<a href='runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Ignore") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=ignore&ac=" . $row['acctid']);
$info .= " - [<a href='runmodule.php?module=friendlist&op=request&ac=" . $row['acctid'] . "' class='colDkGreen'>" . translate_inline("Request") . "</a>]";
addnav("", "runmodule.php?module=friendlist&op=request&ac=" . $row['acctid']);
}
}
rawoutput("{$info}</td></tr>");
}
rawoutput("</table>");
} else {
output("`c`@`bA user was not found with that name.`b`c");
}
output_notl("`n");
}
output("`^`b`cFriend Search...`c`b");
output("`n`nWho do you want to search for?");
output("`n`nName of user: ");
rawoutput("<input name='n' maxlength='50' value=\"" . htmlentities(stripslashes(httppost('n'))) . "\">");
$apply = translate_inline("Search");
rawoutput("<input type='submit' class='button' value='{$apply}'></form>");
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:60,代码来源:friendlist_search.php
示例7: changelog_run
function changelog_run()
{
$op = httpget('op');
$ret = httpget('ret');
$offset = httpget('offset') ?: 1;
$offset = ($offset - 1) * 25;
$offset = filter_var($offset, FILTER_SANITIZE_NUMBER_INT);
$gamelog = db_prefix('gamelog');
$accounts = db_prefix('accounts');
$category = addslashes(get_module_setting('category'));
page_header('Server Changelog');
$sql = db_query("SELECT count(logid) AS n FROM {$gamelog} WHERE category = '{$category}'");
$row = db_fetch_assoc($sql);
addnav('Go back', "{$ret}.php");
addnav('Changes');
for ($i = 1; $i < $row['n'] / 25 + 1; $i++) {
addnav(sprintf("%sPage %s (%s-%s)", $offset / 25 + 1 == $i ? '`^' : '', $i, ($i - 1) * 25 + 1, $i * 25 < $row['n'] ? $i * 25 : $row['n']), "runmodule.php?module=changelog&offset={$i}&ret={$ret}");
}
$sql = db_query("SELECT g.*, a.name FROM {$gamelog} AS g\n LEFT JOIN {$accounts} AS a ON g.who = a.acctid\n WHERE category = '{$category}' ORDER BY logid+0 DESC LIMIT {$offset}, 25");
output("`c`@`bChangelog`b`c`n");
while ($row = db_fetch_assoc($sql)) {
output(get_module_setting('format'), $row['name'], $row['message']);
}
page_footer();
}
示例8: monsterkills_run
function monsterkills_run()
{
page_header("Most Monster Kills");
$acc = db_prefix("accounts");
$mp = db_prefix("module_userprefs");
$sql = "SELECT {$acc}.name AS name,\r\n\t\t{$acc}.acctid AS acctid,\r\n\t\t{$mp}.value AS kills,\r\n\t\t{$mp}.userid FROM {$mp} INNER JOIN {$acc}\r\n\t\tON {$acc}.acctid = {$mp}.userid \r\n\t\tWHERE {$mp}.modulename = 'monsterkills' \r\n\t\tAND {$mp}.setting = 'kills' \r\n\t\tAND {$mp}.value > 0 ORDER BY ({$mp}.value+0)\t\r\n\t\tDESC limit " . get_module_setting("list") . "";
$result = db_query($sql);
$rank = translate_inline("Kills");
$name = translate_inline("Name");
output("`n`b`c`@Most`\$ Monster `@Kills`n`n`c`b");
rawoutput("<table border='0' cellpadding='2' cellspacing='1' align='center'>");
rawoutput("<tr class='trhead'><td align=center>{$name}</td><td align=center>{$rank}</td></tr>");
for ($i = 0; $i < db_num_rows($result); $i++) {
$row = db_fetch_assoc($result);
if ($row['name'] == $session['user']['name']) {
rawoutput("<tr class='trhilight'><td>");
} else {
rawoutput("<tr class='" . ($i % 2 ? "trdark" : "trlight") . "'><td align=left>");
}
output_notl("%s", $row['name']);
rawoutput("</td><td align=right>");
output_notl("%s", $row['kills']);
rawoutput("</td></tr>");
}
rawoutput("</table>");
addnav("Back to HoF", "hof.php");
villagenav();
page_footer();
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:29,代码来源:monsterkills.php
示例9: get_partner
function get_partner($player = false)
{
global $session;
if ($player === false) {
$partner = getsetting("barmaid", "`%Violet");
if ($session['user']['sex'] != SEX_MALE) {
$partner = getsetting("bard", "`^Seth");
}
} else {
if ($session['user']['marriedto'] == INT_MAX) {
$partner = getsetting("barmaid", "`%Violet");
if ($session['user']['sex'] != SEX_MALE) {
$partner = getsetting("bard", "`^Seth");
}
} else {
$sql = "SELECT name FROM " . db_prefix("accounts") . " WHERE acctid = {$session['user']['marriedto']}";
$result = db_query($sql);
if ($row = db_fetch_assoc($result)) {
$partner = $row['name'];
} else {
$session['user']['marriedto'] = 0;
$partner = getsetting("barmaid", "`%Violet");
if ($session['user']['sex'] != SEX_MALE) {
$partner = getsetting("bard", "`^Seth");
}
}
}
}
// No need to translate names...
// tlschema("partner");
// $partner = translate_inline($partner);
// tlschema();
return $partner;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:34,代码来源:partner.php
示例10: get_typeid
function get_typeid($modulename)
{
$sql = "SELECT typeid FROM " . db_prefix("dwellingtypes") . " WHERE module='{$modulename}'";
$res = db_query($sql);
$row = db_fetch_assoc($res);
return $row['typeid'];
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:7,代码来源:func.php
示例11: scrapbots_get_armies
function scrapbots_get_armies($defenderid, $attackerid)
{
global $session;
//get attackers
$sql = "SELECT id,owner,name,activated,hitpoints,brains,brawn,briskness,junglefighter,retreathp FROM " . db_prefix("scrapbots") . " WHERE owner = {$attackerid}";
$result = db_query($sql);
$attacker = array();
for ($i = 0; $i < db_num_rows($result); $i++) {
$attacker[$i] = db_fetch_assoc($result);
}
$sql = "SELECT id,owner,name,activated,hitpoints,brains,brawn,briskness,junglefighter,retreathp FROM " . db_prefix("scrapbots") . " WHERE owner = {$defenderid}";
$result = db_query($sql);
$defender = array();
for ($i = 0; $i < db_num_rows($result); $i++) {
$defender[$i] = db_fetch_assoc($result);
}
debug("Debugging Attacker");
debug($attacker);
debug("Debugging Defender");
debug($defender);
$armies = array("attacker" => $attacker, "defender" => $defender);
//Set starting vals
$armies['attacker']['retreatpct'] = get_module_pref("retreatpct", "scrapbots", $attackerid);
$armies['defender']['retreat'] = get_module_pref("retreatpct", "scrapbots", $defenderid);
debug("Debugging Armies");
debug($armies);
return $armies;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:28,代码来源:battle.php
示例12: bioextension_dohook
function bioextension_dohook($hookname, $args)
{
global $session;
if ($hookname == "bioinfo") {
$sql = "SELECT donation FROM " . db_prefix("accounts") . " WHERE acctid = '" . $args['acctid'] . "'";
$result = db_query($sql);
$row = db_fetch_assoc($result);
if ($row['donation'] >= get_module_setting("threshhold")) {
$bio = get_module_pref("user_extendedbio", "bioextension", $args['acctid']);
$link = get_module_pref("user_extlink", "bioextension", $args['acctid']);
$bio = str_replace(chr(13), "`n", $bio);
$bio = stripslashes($bio);
output("`0%s`n`n", $bio);
if (substr($link, 0, 5) == "http:") {
rawoutput("<a href=\"" . $link . "\">Player's webpage</a><br /><br />");
}
}
} else {
if ($hookname == "footer-prefs") {
$bio = get_module_pref("user_extendedbio");
$limit = get_module_setting("charlimit");
if (strlen($bio) > $limit) {
output("`c`4`bWARNING`b`0`c`nYour Extended Bio is oversized by %s characters. If you navigate away from this page, your Extended Bio will have %s characters indiscriminately cut from the end. Please edit and re-save your Extended Bio to avoid cuts.", strlen($bio) - $limit, strlen($bio) - $limit);
$bio = substr($bio, 0, $limit);
set_module_pref("user_extendedbio", $bio);
}
}
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:30,代码来源:bioextension.php
示例13: tents_dohook
function tents_dohook($hookname, $args)
{
global $session;
switch ($hookname) {
case "worldnav":
$ploc = get_module_pref("worldXYZ", "worldmapen");
$sql = "SELECT owner,type,data FROM " . db_prefix("structures") . " WHERE location = {$ploc}";
$result = db_query($sql);
for ($i = 0; $i < db_num_rows($result); $i++) {
//send structure through module hooks
}
// $chats = unserialize(get_module_setting("placedchats"));
// $ploc = get_module_pref("worldXYZ","worldmapen");
// $chatarea = 0;
// if (!is_array($chats)) {
// $chats = array();
// }
// foreach($chats AS $key => $vals){
// if ($ploc == $vals['loc']['x'].",".$vals['loc']['y'].",1"){
// output("`0There's a little tent here.`n");
// addnav("Investigate Tent","runmodule.php?module=tents&xyz=".$ploc);
// $chatarea = 1;
// break;
// }
// }
// if (!$chatarea){
// }
break;
}
return $args;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:31,代码来源:tents.php
示例14: lovers_install
function lovers_install()
{
module_addhook("newday");
module_addhook("inn");
$sql = "DESCRIBE " . db_prefix("accounts");
$result = db_query($sql);
while ($row = db_fetch_assoc($result)) {
if ($row['Field'] == "seenlover") {
$sql = "SELECT seenlover,acctid FROM " . db_prefix("accounts") . " WHERE seenlover>0";
$result1 = db_query($sql);
debug("Migrating seenlover.`n");
while ($row1 = db_fetch_assoc($result1)) {
$sql = "INSERT INTO " . db_prefix("module_userprefs") . " (modulename,setting,userid,value) VALUES ('lovers','seenlover',{$row1['acctid']},{$row1['seenlover']})";
db_query($sql);
}
//end while
debug("Dropping seenlover column from the user table.`n");
$sql = "ALTER TABLE " . db_prefix("accounts") . " DROP seenlover";
db_query($sql);
//drop it from the user's session too.
unset($session['user']['seenlover']);
}
//end if
}
//end while
return true;
}
开发者ID:CavemanJoe,项目名称:Improbable-Island---DragonScales---DragonBones---LotGD-2.0---Season-Three,代码行数:27,代码来源:lovers.php
示例15: getMembers
/**
* Provides all members of this group.
*
* @return UserGroupMember[]
*/
public function getMembers()
{
// First get all userIDs that are members.
$qAllMembers = db_query(sprintf("SELECT `userID`,`access` FROM `%s_group_members` WHERE `groupID`=%d", db_prefix(), $this->getGroupID()));
$nAllMembers = db_num($qAllMembers);
// Verify that we got any users.
if ($qAllMembers === false || $nAllMembers < 1) {
return array();
}
$members = array();
$userIDs = array();
$rowsIndexedByUID = array();
// Fetch each as User
while ($row = db_fetch_assoc($qAllMembers)) {
$userIDs[] = $row["userID"];
$rowsIndexedByUID[$row["userID"]] = $row;
}
// Fetch the users.
$users = UserManager::getInstance()->getUsersByID($userIDs);
if (count($users) < 1) {
return array();
}
// Create as UserGroupMember
foreach ($users as $user) {
$memberRow = $rowsIndexedByUID[$user->getUserID()];
$member = new UserGroupMember($user->getUserID());
$member->fillInfo($user->getInfo());
// fill extra variables
$member->setAccess($memberRow["access"]);
$member->setGroup($this);
$members[] = $member;
unset($memberRow, $user, $member);
}
return $members;
}