本文整理汇总了PHP中SmrMySqlDatabase::nextRecord方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrMySqlDatabase::nextRecord方法的具体用法?PHP SmrMySqlDatabase::nextRecord怎么用?PHP SmrMySqlDatabase::nextRecord使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类SmrMySqlDatabase
的用法示例。
在下文中一共展示了SmrMySqlDatabase::nextRecord方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: channel_msg_ship
function channel_msg_ship($fp, $rdata)
{
global $channel;
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!ship\\s(.*)\\s$/i', $rdata, $msg)) {
echo_r($msg);
$db = new SmrMySqlDatabase();
$db->query('SELECT * FROM ship_type WHERE ship_name LIKE ' . $db->escape_string('%' . $msg[4] . '%'));
if ($db->nextRecord()) {
$ship_name = $db->getField('ship_name');
$hardpoint = $db->getField('hardpoint');
$speed = $db->getField('speed');
$cost = $db->getField('cost');
$name_length = strlen($ship_name);
$hp_length = strlen('Hardpoints');
$speed_length = strlen('Speed');
$cost_length = max(strlen('Costs'), strlen($cost));
fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad('Name', $name_length) . ' | ' . str_pad('Hardpoints', $hp_length) . ' | ' . str_pad('Speed', $speed_length) . ' | ' . str_pad('Costs', $cost_length) . EOL);
fputs($fp, 'NOTICE ' . $msg[1] . ' :' . str_pad($ship_name, $name_length) . ' | ' . str_pad($hardpoint, $hp_length) . ' | ' . str_pad($speed, $speed_length) . ' | ' . str_pad($cost, $cost_length) . EOL);
} else {
fputs($fp, 'NOTICE ' . $msg[1] . ' :There is no ship called ' . $msg[4] . '!' . EOL);
}
return true;
}
return false;
}
示例2: notice_nickserv_registered_user
function notice_nickserv_registered_user($fp, $rdata)
{
// :NickServ!services@coldfront.net NOTICE Caretaker
if (preg_match('/^:NickServ!services@coldfront.net NOTICE ' . IRC_BOT_NICK . ' :([^ ]+) is ([^.]+)\\s$/i', $rdata, $msg)) {
$nick = $msg[1];
$registeredNick = $msg[2];
echo_r('[NOTICE_NICKSERV_REGISTERED_NICK] ' . $nick . ' is ' . $registeredNick);
$db = new SmrMySqlDatabase();
$db2 = new SmrMySqlDatabase();
$db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick));
while ($db->nextRecord()) {
$seen_id = $db->getField('seen_id');
$db2->query('UPDATE irc_seen SET
registered_nick = ' . $db->escapeString($registeredNick) . '
WHERE seen_id = ' . $seen_id);
}
global $actions;
foreach ($actions as $key => $action) {
// is that a callback for our nick?
if ($action[0] == 'NICKSERV_INFO' && $nick == $action[2]) {
echo_r('Callback found: ' . $action[3]);
unset($actions[$key]);
eval($action[3]);
}
}
return true;
}
return false;
}
示例3: channel_msg_rank
function channel_msg_rank($fp, $rdata)
{
global $channel, $nick;
// did he gave us no parameter?
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:rank\\s$/i', $rdata, $msg)) {
echo_r($msg);
fputs($fp, 'NOTICE ' . $msg[1] . ' :SYNTAX !rank <nick>' . EOL);
return true;
}
// in channel we only accept !rank
// in private msg we accept both
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!rank\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?rank\\s(.*)\\s$/i', $rdata, $msg)) {
echo_r($msg);
$db = new SmrMySqlDatabase();
$db2 = new SmrMySqlDatabase();
$db->query('SELECT * FROM player WHERE player_name = ' . $db->escape_string($msg[4], true));
if ($db->getNumRows()) {
while ($db->nextRecord()) {
$player_name = stripslashes($db->getField('player_name'));
$experience = $db->getField('experience');
$game_id = $db->getField('game_id');
$db2->query('SELECT COUNT(*) as our_rank FROM player ' . 'WHERE game_id = ' . $game_id . ' AND ' . '(experience > ' . $experience . ' OR ' . '(experience = ' . $experience . ' AND ' . 'player_name <= ' . $db->escape_string($player_name, true) . ' ))');
if ($db2->nextRecord()) {
$our_rank = $db2->getField('our_rank');
}
// how many players are there?
$db2->query('SELECT COUNT(*) as total_player FROM player WHERE game_id = ' . $game_id);
if ($db2->nextRecord()) {
$total_player = $db2->getField('total_player');
}
$db2->query('SELECT game_name FROM game WHERE game_id = ' . $game_id);
if ($db2->nextRecord()) {
$game_name = $db2->getField('game_name');
}
fputs($fp, 'NOTICE ' . $msg[1] . ' :' . $msg[1] . ' you are ranked ' . $our_rank . ' out of ' . $total_player . ' in ' . $game_name . '!' . EOL);
}
} else {
fputs($fp, 'NOTICE ' . $msg[1] . ' :No Trader found that matches your query!' . EOL);
}
return true;
}
return false;
}
示例4: channel_msg_seedlist_add
function channel_msg_seedlist_add($fp, $rdata, $account, $player)
{
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!seedlist add (.*)\\s$/i', $rdata, $msg)) {
$nick = $msg[1];
$user = $msg[2];
$host = $msg[3];
$channel = $msg[4];
$sectors = explode(' ', $msg[5]);
echo_r('[SEEDLIST_ADD] 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 add 1537' . EOL);
return true;
}
}
$db = new SmrMySqlDatabase();
foreach ($sectors as $sector) {
// check if the sector is a part of the game
$db->query('SELECT sector_id
FROM sector
WHERE game_id = ' . $player->getGameID() . '
AND sector_id = ' . $db->escapeNumber($sector));
if (!$db->nextRecord()) {
fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' does not exist in current game.' . EOL);
continue;
}
// check if the given sector is already part of the seed list
$db->query('SELECT sector_id
FROM alliance_has_seedlist
WHERE alliance_id = ' . $player->getAllianceID() . '
AND game_id = ' . $player->getGameID() . '
AND sector_id = ' . $db->escapeNumber($sector));
if ($db->nextRecord()) {
// fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' is already in the seedlist.' . EOL);
continue;
}
// add sector to db
$db->query('INSERT INTO alliance_has_seedlist
(alliance_id, game_id, sector_id)
VALUES (' . $player->getAllianceID() . ', ' . $player->getGameID() . ', ' . $db->escapeNumber($sector) . ')');
// fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' has been added.' . EOL);
}
fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors have been added.' . EOL);
return true;
}
return false;
}
示例5: user_nick
/**
* Someone changed his nick
*/
function user_nick($fp, $rdata)
{
if (preg_match('/^:(.*)!(.*)@(.*)\\sNICK\\s:(.*)\\s$/i', $rdata, $msg)) {
$nick = $msg[1];
$user = $msg[2];
$host = $msg[3];
$new_nick = $msg[4];
echo_r('[NICK] ' . $nick . ' -> ' . $new_nick);
// database object
$db = new SmrMySqlDatabase();
$db2 = new SmrMySqlDatabase();
$channel_list = array();
// 'sign off' all active old_nicks (multiple channels)
$db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND signed_off = 0');
while ($db->nextRecord()) {
$seen_id = $db->getInt('seen_id');
// remember channels where this nick was active
array_push($channel_list, $db->getField('channel'));
$db2->query('UPDATE irc_seen SET signed_off = ' . time() . ' WHERE seen_id = ' . $seen_id);
}
// now sign in the new_nick in every channel
foreach ($channel_list as $channel) {
// 'sign in' the new nick
$db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($new_nick) . ' AND channel = ' . $db->escapeString($channel));
if ($db->nextRecord()) {
// exiting nick?
$seen_id = $db->getField('seen_id');
$db->query('UPDATE irc_seen SET ' . 'signed_on = ' . time() . ', ' . 'signed_off = 0, ' . 'user = ' . $db->escapeString($user) . ', ' . 'host = ' . $db->escapeString($host) . ', ' . 'registered = NULL ' . 'WHERE seen_id = ' . $seen_id);
} else {
// new nick?
$db->query('INSERT INTO irc_seen (nick, user, host, channel, signed_on) VALUES(' . $db->escapeString($new_nick) . ', ' . $db->escapeString($user) . ', ' . $db->escapeString($host) . ', ' . $db->escapeString($channel) . ', ' . time() . ')');
}
}
unset($channel_list);
return true;
}
return false;
}
示例6: channel_msg_level
function channel_msg_level($fp, $rdata)
{
global $channel, $nick;
// in channel we only accept !rank
// in private msg we accept both
if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!level\\s(.*)\\s$/i', $rdata, $msg) || preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $nick . '\\s:?level\\s(.*)\\s$/i', $rdata, $msg)) {
echo_r($msg);
$db = new SmrMySqlDatabase();
$db->query('SELECT * FROM level WHERE level_id = ' . $msg[4]);
if ($db->nextRecord()) {
$level_name = $db->getField('level_name');
$experience = $db->getField('requirement');
fputs($fp, 'NOTICE ' . $msg[1] . ' :For a ' . $level_name . ' you need to have ' . $experience . ' experience points!' . EOL);
} else {
fputs($fp, 'NOTICE ' . $msg[1] . ' :This Level doesn\'t exist!!' . EOL);
}
return true;
}
return false;
}
示例7: check_sms_response
function check_sms_response($fp)
{
// get one dlr per time so we do not spam anyone
$db = new SmrMySqlDatabase();
$db->query('SELECT *
FROM account_sms_response
LEFT JOIN account_sms_log USING (message_id)
WHERE announce = 0');
if ($db->nextRecord()) {
$response_id = $db->getField('response_id');
$message_id = $db->getField('message_id');
$message = $db->getField('message');
$orig_sender_id = $db->getField('account_id');
echo_r('Found new SMS response... ' . $message_id);
$orig_sender =& SmrAccount::getAccount($orig_sender_id, true);
fputs($fp, 'NOTICE ' . $orig_sender->getIrcNick() . ' :You have received a response to your text: ' . EOL);
fputs($fp, 'NOTICE ' . $orig_sender->getIrcNick() . ' :' . $message . EOL);
// update announce status
$db->query('UPDATE account_sms_response
SET announce = 1
WHERE response_id = ' . $response_id);
}
}
示例8: channel_part
function channel_part($fp, $rdata)
{
// :Azool!Azool@coldfront-F706F7E1.co.hfc.comcastbusiness.net PART #smr-irc :
// :SomeGuy!mrspock@coldfront-DD847655.dip.t-dialin.net PART #smr-irc
if (preg_match('/^:(.*)!(.*)@(.*)\\sPART\\s(.*?)\\s/i', $rdata, $msg)) {
$nick = $msg[1];
$user = $msg[2];
$host = $msg[3];
$channel = $msg[4];
echo_r('[PART] ' . $nick . '!' . $user . '@' . $host . ' ' . $channel);
// database object
$db = new SmrMySqlDatabase();
$db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND channel = ' . $db->escapeString($channel));
// exiting nick?
if ($db->nextRecord()) {
$seen_id = $db->getField('seen_id');
$db->query('UPDATE irc_seen SET signed_off = ' . time() . ' WHERE seen_id = ' . $seen_id);
} else {
// we don't know this one, but who cares? he just left anyway...
}
return true;
}
return false;
}
示例9: array
//array for mb so we dont duplicate
$mb_msgs = array();
while ($db->nextRecord()) {
//search every message on webboards for each word first
$id = $db->getField('id');
$word = $db->getField('keyword');
$db2->query('SELECT * FROM alliance_thread WHERE sender_id != 0 AND text LIKE ' . $db2->escapeString('%' . $word . '%') . ' ORDER BY time DESC');
while ($db2->nextRecord()) {
//assume we arent skipping
$skip = 'no';
$bad = $db2->getField('text');
$db3->query('SELECT * FROM mb_keywords WHERE assoc = ' . $db3->escapeNumber($id) . ' AND type = \'ignore\' AND `use` = 1');
while ($db3->nextRecord()) {
$word2 = $db3->getField('keyword');
$db4->query('SELECT ' . $db->escapeString($bad) . ' LIKE ' . $db4->escapeString('%' . $word2 . '%'));
$db4->nextRecord();
if ($db4->getField(0)) {
$skip = 'yes';
}
}
if ($skip == 'yes') {
continue;
}
//get info
$game_id = $db2->getField('game_id');
$alliance_id = $db2->getField('alliance_id');
$thread_id = $db2->getField('thread_id');
$reply_id = $db2->getField('reply_id');
//put in an array
$array_filler = $game_id . ',' . $alliance_id . ',' . $thread_id . ',' . $reply_id;
//check if its already been done
示例10: SocialLogin
// ********************************
if (SmrSession::$account_id == 0) {
if (isset($_REQUEST['loginType'])) {
require_once LIB . 'Login/SocialLogin.class.inc';
$socialLogin = new SocialLogin($_REQUEST['loginType']);
if (!$socialLogin->isValid()) {
$msg = 'Error validating login.';
header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
exit;
}
$loginType = $socialLogin->getLoginType();
$authKey = $socialLogin->getUserID();
$db->query('SELECT account_id,old_account_id FROM account JOIN account_auth USING(account_id)
WHERE login_type = ' . $db->escapeString($loginType) . '
AND auth_key = ' . $db->escapeString($authKey) . ' LIMIT 1');
if ($db->nextRecord()) {
// register session
SmrSession::$account_id = $db->getInt('account_id');
SmrSession::$old_account_id = $db->getInt('old_account_id');
} else {
if ($socialLogin->getEmail() != null) {
$db->query('SELECT account_id,old_account_id FROM account ' . 'WHERE email = ' . $db->escapeString($socialLogin->getEmail()) . ' LIMIT 1');
}
if ($socialLogin->getEmail() != null && $db->nextRecord()) {
//Email already has an account so let's link.
$account =& SmrAccount::getAccount($db->getField('account_id'));
$account->addAuthMethod($socialLogin->getLoginType(), $socialLogin->getUserID());
$account->setValidated(true);
SmrSession::$account_id = $db->getField('account_id');
SmrSession::$old_account_id = $db->getField('old_account_id');
} else {
示例11: SmrMySqlDatabase
if ($db->getNumRows()) {
$PHP_OUTPUT .= '<br /><h2>Your accounts</h2><br />';
$PHP_OUTPUT .= '<div align=center>';
$PHP_OUTPUT .= '<table class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
$container = create_container('skeleton.php', 'bank_anon.php');
$db2 = new SmrMySqlDatabase();
while ($db->nextRecord()) {
$PHP_OUTPUT .= '<tr><td class="shrink center">';
$PHP_OUTPUT .= $db->getInt('anon_id');
$PHP_OUTPUT .= '</td><td>';
$PHP_OUTPUT .= $db->getField('password');
$PHP_OUTPUT .= '</td><td class="shrink noWrap">';
$db2->query('SELECT MAX(time) FROM anon_bank_transactions
WHERE game_id=' . $db2->escapeNumber($player->getGameID()) . '
AND anon_id=' . $db2->escapeNumber($db->getInt('anon_id')) . ' LIMIT 1');
if ($db2->nextRecord() && $db2->getInt('MAX(time)')) {
$PHP_OUTPUT .= date(DATE_FULL_SHORT, $db2->getInt('MAX(time)'));
} else {
$PHP_OUTPUT .= 'No transactions';
}
$PHP_OUTPUT .= '</td><td class="right shrink">';
$PHP_OUTPUT .= $db->getInt('amount');
$PHP_OUTPUT .= '</td><td class="button">';
$container['AccountNumber'] = $db->getInt('anon_id');
$container['Password'] = $db->getField('password');
$PHP_OUTPUT .= create_button($container, 'Access Account');
$PHP_OUTPUT .= '</td></tr>';
}
$PHP_OUTPUT .= '</table></div><br /><br />';
}
$container = create_container('skeleton.php', 'bank_anon.php');
示例12: while
if ($db->nextRecord()) {
$PHP_OUTPUT .= '<option value="0">[please select]</option>';
// get all accounts
$db->query('SELECT account_id, login
FROM account
ORDER BY login');
while ($db->nextRecord()) {
// get current account id and login
$curr_account_id = $db->getInt('account_id');
$curr_login = $db->getField('login');
// check if this guy is already in
$db2->query('SELECT player_name
FROM player
WHERE account_id = ' . $db2->escapeNumber($curr_account_id) . '
AND game_id = ' . $db2->escapeNumber($var['game_id']));
if (!$db2->nextRecord()) {
$PHP_OUTPUT .= '<option value="' . $curr_account_id . '">' . $curr_login . '</option>';
}
}
} else {
$PHP_OUTPUT .= '<option value="1">MrSpock</option>';
$player_name = 'MrSpock';
$readonly = ' readonly';
}
$PHP_OUTPUT .= '</select><br /><br /><br />';
$PHP_OUTPUT .= 'Player Name:<br /><br />';
$PHP_OUTPUT .= '<input type="text" name="player_name" value="' . $player_name . '" id="InputFields" style="padding-left:10px;"' . $readonly . '><br /><br /><br />';
$PHP_OUTPUT .= 'Player Race:<br /><br />';
$PHP_OUTPUT .= '<select name="race_id" id="InputFields" style="padding-left:10px;">';
//this prevents multiple races appearing when there is more than 1 game
$only = array();
示例13: elseif
$res = $db->getField('buyer_restriction');
if ($res == 1) {
$align = '+';
} elseif ($res == 2) {
$align = '-';
} else {
$align = '0';
}
$speed = $db->getField('speed');
$cost = $db->getField('cost');
$hard = $db->getField('hardpoint');
//assuem 10 for now its not implemented
$mr = 10;
$db3->query('SELECT * FROM hardware_type ORDER BY hardware_type_id');
$props = array();
while ($db3->nextRecord()) {
$hard_id = $db3->getField('hardware_type_id');
$db2->query('SELECT * FROM ship_type_support_hardware WHERE ship_type_id = ' . $id . ' ORDER BY hardware_type_id AND hardware_type_id = ' . $hard_id);
while ($db2->nextRecord()) {
$props[$hard_id] = $db2->getField('max_amount');
}
}
$shields = $props[HARDWARE_SHIELDS];
$armour = $props[HARDWARE_ARMOUR];
$cargo = $props[HARDWARE_CARGO];
$combat = $props[HARDWARE_COMBAT];
$scouts = $props[HARDWARE_SCOUT];
$mines = $props[HARDWARE_MINE];
$scanner = $props[HARDWARE_SCANNER];
$cloak = $props[HARDWARE_CLOAK];
$illus = $props[HARDWARE_ILLUSION];
示例14: forward
<?php
$container = create_container('skeleton.php', 'word_filter.php');
if (!isset($_REQUEST['Word']) || !isset($_REQUEST['WordReplacement'])) {
$container['error'] = 1;
forward($container);
exit;
}
$word = strtoupper(trim($_REQUEST['Word']));
$word_replacement = strtoupper(trim($_REQUEST['WordReplacement']));
if (empty($word) || empty($word_replacement)) {
$container['error'] = 1;
forward($container);
exit;
}
$db = new SmrMySqlDatabase();
$db->query('SELECT word_id FROM word_filter WHERE word_value=' . $db->escapeString($word) . ' LIMIT 1');
if ($db->nextRecord()) {
$container['error'] = 1;
forward($container);
exit;
}
$db->query('INSERT INTO word_filter(word_value,word_replacement) VALUES (' . $db->escapeString($word) . ',' . $db->escapeString($word_replacement) . ')');
$container['error'] = 2;
forward($container);
示例15: forward
<?php
$action = $_REQUEST['action'];
if ($action == 'Skip >>') {
$container = create_container('skeleton.php', 'universe_create_ships.php');
$container['game_id'] = $var['game_id'];
forward($container);
}
$planet = $_REQUEST['planet'];
if (!isset($planet)) {
create_error('Couldn\'t determine how many planets to add!');
}
$db2 = new SmrMySqlDatabase();
$db2->query('SELECT * FROM game WHERE game_id = ' . $db->escapeNumber($var['game_id']));
$db2->nextRecord();
$date = $db2->getField('start_date');
list($year, $month, $day) = explode('-', $date);
// adjust the time so it is game start time
$time = mktime(0, 0, 0, $month, $day, $year);
reset($planet);
foreach ($planet as $galaxy_id => $amount) {
$count = 0;
// get a sector with none port
$db->query('SELECT * FROM sector
WHERE game_id = ' . $db->escapeNumber($var['game_id']) . '
AND galaxy_id = ' . $db->escapeNumber($galaxy_id) . '
ORDER BY rand()');
while ($count < $amount && $db->nextRecord()) {
$sector_id = $db->getInt('sector_id');
// does this sector have a fed beacon??
$db2->query('SELECT * FROM location