本文整理汇总了PHP中SmrMySqlDatabase::escapeArray方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrMySqlDatabase::escapeArray方法的具体用法?PHP SmrMySqlDatabase::escapeArray怎么用?PHP SmrMySqlDatabase::escapeArray使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrMySqlDatabase
的用法示例。
在下文中一共展示了SmrMySqlDatabase::escapeArray方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: channel_msg_seedlist_del
function channel_msg_seedlist_del($fp, $rdata, $account, $player)
{
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!seedlist del (.*)\\s$/i', $rdata, $msg)) {
$nick = $msg[1];
$user = $msg[2];
$host = $msg[3];
$channel = $msg[4];
$sectors = explode(' ', $msg[5]);
echo_r('[SEEDLIST_DEL] by ' . $nick . ' in ' . $channel);
// check if $nick is leader
if (!$player->isAllianceLeader(true)) {
fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', only the leader of the alliance manages the seedlist.' . EOL);
return true;
}
foreach ($sectors as $sector) {
// see if the sector is numeric
if (!is_numeric($sector)) {
fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors all need to be numeric. Example: !seedlist del 1537' . EOL);
return true;
}
}
// add sectors to db
$db = new SmrMySqlDatabase();
$db->query('DELETE FROM alliance_has_seedlist
WHERE alliance_id = ' . $player->getAllianceID() . '
AND game_id = ' . $player->getGameID() . '
AND sector_id IN (' . $db->escapeArray($sectors) . ')');
fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors have been deleted.' . EOL);
return true;
}
return false;
}
示例2: array
<?php
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'message_blacklist.php';
if (!isset($_REQUEST['entry_ids']) || !is_array($_REQUEST['entry_ids'])) {
$container['error'] = 4;
forward($container);
exit;
}
foreach ($_REQUEST['entry_ids'] as $entry_id) {
if (!is_numeric($entry_id)) {
$container['error'] = 5;
forward($container);
exit;
} else {
$entry_ids[] = $entry_id;
}
}
$db = new SmrMySqlDatabase();
$db->query('DELETE FROM message_blacklist WHERE account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND entry_id IN (' . $db->escapeArray($entry_ids) . ')');
forward($container);
示例3: foreach
$use = 'TRUE';
}
//check that each value is legit and add it to db string
$new = MULTI_CHECKING_COOKIE_VERSION;
foreach ($old as $accID) {
if (is_numeric($accID)) {
$new .= '-' . $accID;
}
}
$db->query('REPLACE INTO multi_checking_cookie (account_id, array, `use`) VALUES (' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($new) . ', ' . $db->escapeString($use) . ')');
//update newest cookie
setcookie('Session_Info', $new, TIME + 157680000);
}
// this sn identifies our container later
$href = SmrSession::getNewHREF(create_container('login_check_processing.php'), true);
SmrSession::update();
//get rid of expired messages
$db2->query('UPDATE message SET receiver_delete = \'TRUE\', sender_delete = \'TRUE\', expire_time = 0 WHERE expire_time < ' . $db->escapeNumber(TIME) . ' AND expire_time != 0');
// Mark message as read if it was sent to self as a mass mail.
$db2->query('UPDATE message SET msg_read = \'TRUE\' WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND account_id = sender_id AND message_type_id IN (' . $db->escapeArray(array(MSG_ALLIANCE, MSG_GLOBAL, MSG_POLITICAL)) . ');');
//check to see if we need to remove player_has_unread
$db2 = new SmrMySqlDatabase();
$db2->query('DELETE FROM player_has_unread_messages WHERE account_id = ' . $db->escapeNumber($account->getAccountID()));
$db2->query('
INSERT INTO player_has_unread_messages (game_id, account_id, message_type_id)
SELECT game_id, account_id, message_type_id FROM message WHERE account_id = ' . $db->escapeNumber($account->getAccountID()) . ' AND msg_read = ' . $db->escapeBoolean(false) . ' AND receiver_delete = ' . $db->escapeBoolean(false));
header('Location: ' . $href);
exit;
} catch (Exception $e) {
handleException($e);
}
示例4: SmrMySqlDatabase
$games['Play'][$index]['Maintenance'] = $curr_player->turns;
$games['Play'][$index]['LastActive'] = format_time(TIME - $curr_player->last_active, TRUE);
$games['Play'][$index]['LastMovement'] = format_time(TIME - $curr_player->last_active, TRUE);
}
}
}
$db = new SmrMySqlDatabase();
}
if (empty($games['Play'])) {
unset($games['Play']);
}
//End Compat
if (count($game_id_list) > 0) {
$db->query('SELECT start_date, end_date, game.game_id as game_id, game_name, max_players, game_type, credits_needed, game_speed
FROM game
WHERE game_id NOT IN (' . $db->escapeArray($game_id_list) . ')
AND end_date >= ' . $db->escapeNumber(TIME) . '
AND enabled = ' . $db->escapeBoolean(true) . '
ORDER BY start_date DESC');
} else {
$db->query('SELECT start_date, end_date, game.game_id as game_id, game_name, max_players, game_type, credits_needed, game_speed
FROM game
WHERE end_date >= ' . $db->escapeNumber(TIME) . '
AND enabled = ' . $db->escapeBoolean(true) . '
ORDER BY start_date DESC');
}
// ***************************************
// ** Join Games
// ***************************************
// are there any results?
if ($db->getNumRows() > 0) {
示例5: changeNPCLogin
function changeNPCLogin()
{
global $NPC_LOGIN, $actions, $NPC_LOGINS_USED, $underAttack, $previousContainer;
if ($actions > 0) {
debug('We have taken actions and now want to change NPC, let\'s exit and let next script choose a new NPC to reset execution time', getrusage());
exitNPC();
}
$actions = -1;
$GLOBALS['TRADE_ROUTE'] = null;
$db = new SmrMySqlDatabase();
$db->query('UPDATE npc_logins SET working=' . $db->escapeBoolean(false) . ' WHERE login=' . $db->escapeString($NPC_LOGIN['Login']));
if ($db->getChangedRows() > 0) {
debug('Unlocked NPC: ' . $NPC_LOGIN['Login']);
} else {
debug('Failed to unlock NPC: ' . $NPC_LOGIN['Login']);
}
$NPC_LOGIN = null;
// We chose a new NPC, we don't care what we were doing beforehand.
$previousContainer = null;
debug('Choosing new NPC');
$db2 = new SmrMySqlDatabase();
$db->query('SELECT login, npc.player_name, alliance_name
FROM npc_logins npc
LEFT JOIN account a USING(login)
LEFT JOIN player p ON a.account_id = p.account_id AND p.game_id = ' . $db->escapeNumber(NPC_GAME_ID) . '
WHERE active=' . $db->escapeBoolean(true) . ' AND working=' . $db->escapeBoolean(false) . ' AND login NOT IN (' . $db->escapeArray($NPC_LOGINS_USED) . ')
ORDER BY (turns IS NOT NULL), turns DESC');
while ($db->nextRecord()) {
$db2->query('UPDATE npc_logins SET working=' . $db2->escapeBoolean(true) . ' WHERE login=' . $db2->escapeString($db->getField('login')) . ' AND working=' . $db2->escapeBoolean(false));
if ($db2->getChangedRows() > 0) {
$NPC_LOGIN = array('Login' => $db->getField('login'), 'PlayerName' => $db->getField('player_name'), 'AllianceName' => $db->getField('alliance_name'));
break;
}
}
$NPC_LOGINS_USED[] = $NPC_LOGIN['Login'];
if ($NPC_LOGIN === null) {
debug('No free NPCs');
exitNPC();
}
debug('Chosen NPC: ' . $NPC_LOGIN['Login']);
if (SmrAccount::getAccountByName($NPC_LOGIN['Login']) == null) {
debug('Creating account for: ' . $NPC_LOGIN['Login']);
$account =& SmrAccount::createAccount($NPC_LOGIN['Login'], '', 'NPC@smrealms.de', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 'NPC', 0, 0);
$account->setValidated(true);
} else {
$account =& SmrAccount::getAccountByName($NPC_LOGIN['Login']);
}
$GLOBALS['account'] =& $account;
SmrSession::$account_id = $account->getAccountID();
$underAttack = false;
//Auto-create player if need be.
$db->query('SELECT 1 FROM player WHERE account_id = ' . $account->getAccountID() . ' AND game_id = ' . NPC_GAME_ID . ' LIMIT 1');
if (!$db->nextRecord()) {
SmrSession::$game_id = 0;
//Have to be out of game to join game.
debug('Auto-creating player: ' . $account->getLogin());
processContainer(joinGame(SmrSession::$game_id, $NPC_LOGIN['PlayerName']));
}
throw new Exception('Forward');
}
示例6: while
if ($save) {
$db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($game_id));
while ($db->nextRecord()) {
$id = $db->getInt('alliance_id');
//we need info for forces
//populate alliance list
$db2->query('SELECT * FROM player
WHERE alliance_id = ' . $db2->escapeNumber($id) . '
AND game_id = ' . $db2->escapeNumber($game_id));
$list = array(0);
while ($db2->nextRecord()) {
$list[] = $db2->getInt('account_id');
}
$db2->query('SELECT sum(mines) as sum_m, sum(combat_drones) as cds, sum(scout_drones) as sds
FROM sector_has_forces
WHERE owner_id IN (' . $db2->escapeArray($list) . ') AND game_id = ' . $db2->escapeNumber($game_id));
if ($db2->nextRecord()) {
$mines = $db2->getInt('sum_m');
$cds = $db2->getInt('cds');
$sds = $db2->getInt('sds');
} else {
$mines = 0;
$cds = 0;
$sds = 0;
}
// get info we want
$name = $db->getField('alliance_name');
$leader = $db->getInt('leader_id');
$kills = $db->getInt('alliance_kills');
$deaths = $db->getInt('alliance_deaths');
// insert into history db