本文整理汇总了PHP中SmrMySqlDatabase::escapeBoolean方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrMySqlDatabase::escapeBoolean方法的具体用法?PHP SmrMySqlDatabase::escapeBoolean怎么用?PHP SmrMySqlDatabase::escapeBoolean使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrMySqlDatabase
的用法示例。
在下文中一共展示了SmrMySqlDatabase::escapeBoolean方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: array
ORDER BY message_type_id');
} else {
$db->query('SELECT * FROM message_type
WHERE message_type_id != ' . $db->escapeNumber(MSG_POLITICAL) . '
ORDER BY message_type_id');
}
$messageBoxes = array();
while ($db->nextRecord()) {
$message_type_id = $db->getField('message_type_id');
$messageBox['Name'] = $db->getField('message_type_name');
// do we have unread msges in that folder?
$db2->query('SELECT 1 FROM message
WHERE account_id = ' . $db2->escapeNumber($player->getAccountID()) . '
AND game_id = ' . $db2->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db2->escapeNumber($message_type_id) . '
AND msg_read = ' . $db2->escapeBoolean(false) . '
AND receiver_delete = ' . $db2->escapeBoolean(false) . ' LIMIT 1');
$messageBox['HasUnread'] = $db2->getNumRows() != 0;
$messageBox['MessageCount'] = 0;
// get number of msges
$db2->query('SELECT count(message_id) as message_count FROM message
WHERE account_id = ' . $db2->escapeNumber($player->getAccountID()) . '
AND game_id = ' . $db2->escapeNumber($player->getGameID()) . '
AND message_type_id = ' . $db2->escapeNumber($message_type_id) . '
AND receiver_delete = ' . $db2->escapeBoolean(false));
if ($db2->nextRecord()) {
$messageBox['MessageCount'] = $db2->getField('message_count');
}
$container = create_container('skeleton.php', 'message_view.php');
$container['folder_id'] = $message_type_id;
$messageBox['ViewHref'] = SmrSession::getNewHREF($container);
示例2: 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);
}
示例3: 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');
}
示例4: SmrMySqlDatabase
$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) {
$games['Join'] = array();
// iterate over the resultset