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


PHP SmrMySqlDatabase::escapeString方法代码示例

本文整理汇总了PHP中SmrMySqlDatabase::escapeString方法的典型用法代码示例。如果您正苦于以下问题:PHP SmrMySqlDatabase::escapeString方法的具体用法?PHP SmrMySqlDatabase::escapeString怎么用?PHP SmrMySqlDatabase::escapeString使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在SmrMySqlDatabase的用法示例。


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

示例1: 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;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:29,代码来源:notice.php

示例2: 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;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:24,代码来源:channel.php

示例3: 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;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:41,代码来源:user.php

示例4: check_sms_dlr

function check_sms_dlr($fp)
{
    // get one dlr per time so we do not spam anyone
    $db = new SmrMySqlDatabase();
    $db->query('SELECT * 
				FROM account_sms_dlr
				LEFT JOIN account_sms_log USING (message_id)
				WHERE announce = 0
				ORDER BY receive_time');
    if ($db->nextRecord()) {
        $message_id = $db->getField('message_id');
        $sender_id = $db->getField('account_id');
        $receiver_id = $db->getField('receiver_id');
        $status = $db->getField('status');
        //		$send_time = $db->getField('send_time');
        //		$receive_time = $db->getField('receive_time');
        echo_r('Found new SMS DLR... ' . $message_id);
        $sender =& SmrAccount::getAccount($sender_id, true);
        $receiver =& SmrAccount::getAccount($receiver_id, true);
        if ($status == 'DELIVERED') {
            fputs($fp, 'NOTICE ' . $sender->getIrcNick() . ' :Your text message has been delivered to ' . $receiver->getIrcNick() . '\'s cell phone.' . EOL);
        } elseif ($status == 'NOT_DELIVERED') {
            fputs($fp, 'NOTICE ' . $sender->getIrcNick() . ' :Your text message has NOT been delivered. Most likely ' . $receiver->getIrcNick() . ' has entered an invalid cell phone number.' . EOL);
        } elseif ($status == 'BUFFERED') {
            fputs($fp, 'NOTICE ' . $sender->getIrcNick() . ' :Your text message has been buffered and will be delivered when ' . $receiver->getIrcNick() . ' turns on his/her cell phone.' . EOL);
        } elseif ($status == 'TRANSMITTED') {
            fputs($fp, 'NOTICE ' . $sender->getIrcNick() . ' :Your text message has been sent.' . EOL);
        } else {
            fputs($fp, 'NOTICE ' . $sender->getIrcNick() . ' :Something unexpected happend to your text message. Status returned by gateway was: ' . $status . EOL);
        }
        // update announce status
        $db->query('UPDATE account_sms_dlr
					SET announce = 1
					WHERE message_id = ' . $message_id . '
						AND status = ' . $db->escapeString($status));
    }
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:37,代码来源:maintenance.php

示例5: SocialLogin

    // * C r e a t e   S e s s i o n
    // *
    // ********************************
    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');
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:login_processing2.php

示例6: urldecode

	<tr>
	<td colspan="3" height="1" bgcolor="#0B8D35"></td>
	</tr>
	<tr>
	<td width="1" bgcolor="#0B8D35"></td>
	<td align="left" valign="top" bgcolor="#06240E">
	<table width="100%" height="100%" border="0" cellspacing="5" cellpadding="5">
	<tr>
	<td valign="top">
	<?php 
    if (!empty($_SERVER['QUERY_STRING'])) {
        // query string should be a nick or some letters of a nick
        $query = urldecode($_SERVER['QUERY_STRING']);
        $db->query('SELECT account_id as album_id
					FROM album JOIN account USING(account_id)
					WHERE hof_name LIKE ' . $db->escapeString($query . '%') . ' AND
						  approved = \'YES\'
					ORDER BY hof_name');
        if ($db->getNumRows() > 1) {
            $db2->query('SELECT account_id as album_id
					FROM album JOIN account USING(account_id)
					WHERE hof_name = ' . $db->escapeString($query) . ' AND
						  approved = \'YES\'
					ORDER BY hof_name');
            if ($db2->nextRecord()) {
                album_entry($db2->getField('album_id'));
            } else {
                // get all id's and build array
                $album_ids = array();
                while ($db->nextRecord()) {
                    $album_ids[] = $db->getField('album_id');
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:index.php

示例7: channel_msg_forces

function channel_msg_forces($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!forces(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $galaxy = trim($msg[5]);
        echo_r('[FORCE_EXPIRE] by ' . $nick . ' in ' . $channel . ' Galaxy: ' . $galaxy);
        // did we get a galaxy name?
        $db = new SmrMySqlDatabase();
        if (!empty($galaxy)) {
            $db->query('SELECT sector_has_forces.sector_id AS sector, combat_drones, scout_drones, mines, expire_time
						FROM sector_has_forces
						LEFT JOIN sector USING (sector_id, game_id)
						LEFT JOIN game_galaxy USING (game_id, galaxy_id)
						WHERE sector_has_forces.game_id = ' . $player->getGameID() . '
							AND galaxy_name = ' . $db->escapeString($galaxy) . '
							AND owner_id IN (
								SELECT account_id
								FROM player
								WHERE game_id = ' . $player->getGameID() . '
									AND alliance_id = ' . $player->getAllianceID() . '
							)
						ORDER BY expire_time ASC');
        } else {
            $db->query('SELECT sector_has_forces.sector_id AS sector, combat_drones, scout_drones, mines, expire_time
				FROM sector_has_forces
				WHERE game_id = ' . $player->getGameID() . '
					AND owner_id IN (
						SELECT account_id
						FROM player
						WHERE game_id = ' . $player->getGameID() . '
						AND alliance_id = ' . $player->getAllianceID() . '
					)
				ORDER BY expire_time ASC');
        }
        if ($db->nextRecord()) {
            $sector_id = $db->getField('sector');
            $expire = $db->getField('expire_time');
            fputs($fp, 'PRIVMSG ' . $channel . ' :Forces in sector ' . $sector_id . ' will expire in ' . format_time($expire - time()) . EOL);
        } else {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your alliance does not own any forces that could expire.' . EOL);
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:48,代码来源:channel_msg.php

示例8: album_entry

function album_entry($album_id)
{
    // database object
    $db = new SmrMySqlDatabase();
    // list of all first letter nicks
    create_link_list();
    if (SmrSession::$account_id != 0 && $album_id != SmrSession::$account_id) {
        $db->query('UPDATE album
				SET page_views = page_views + 1
				WHERE account_id = ' . $db->escapeNumber($album_id) . ' AND
					approved = \'YES\'');
    }
    $db->query('SELECT *
				FROM album
				WHERE account_id = ' . $db->escapeNumber($album_id) . ' AND
					approved = \'YES\'');
    if ($db->nextRecord()) {
        $location = stripslashes($db->getField('location'));
        $email = stripslashes($db->getField('email'));
        $website = stripslashes($db->getField('website'));
        $day = $db->getField('day');
        $month = $db->getField('month');
        $year = $db->getField('year');
        $other = nl2br(stripslashes($db->getField('other')));
        $page_views = $db->getField('page_views');
        $disabled = $db->getField('disabled') == 'TRUE';
    } else {
        echo '<h1>Error</h1>';
        echo 'This user doesn\'t have an entry in our album!';
        return;
    }
    // get this user's nick
    $nick = get_album_nick($album_id);
    echo '<table border="0" align="center" cellpadding="5" cellspacing="0">';
    echo '<tr>';
    echo '<td style="text-align: center;" colspan="2">';
    echo '<div style="margin-left: auto; margin-right: auto; width: 50%">';
    echo '<table style="width: 100%">';
    echo '<tr>';
    $db->query('SELECT hof_name
				FROM album JOIN account USING(account_id)
				WHERE hof_name < ' . $db->escapeString($nick) . ' AND
					approved = \'YES\'
				ORDER BY hof_name DESC
				LIMIT 1');
    echo '<td style="text-align: center; width: 30%" valign="middle">';
    if ($db->nextRecord()) {
        $priv_nick = $db->getField('hof_name');
        echo '<a href="' . URL . '/album/?' . urlencode($priv_nick) . '"><img src="' . URL . '/images/album/rew.jpg" alt="' . $priv_nick . '" border="0"></a>&nbsp;&nbsp;&nbsp;';
    }
    echo '</td>';
    echo '<td style="text-align: center;" valign="middle"><span style="font-size:150%;">' . $nick . '</span><br /><span style="font-size:75%;">Views: ' . $page_views . '</span></td>';
    $db->query('SELECT hof_name
				FROM album JOIN account USING(account_id)
				WHERE hof_name > ' . $db->escapeString($nick) . ' AND
					approved = \'YES\'
				ORDER BY hof_name
				LIMIT 1');
    echo '<td style="text-align: center; width: 30%" valign="middle">';
    if ($db->nextRecord()) {
        $next_nick = $db->getField('hof_name');
        echo '&nbsp;&nbsp;&nbsp;<a href="' . URL . '/album/?' . urlencode($next_nick) . '"><img src="' . URL . '/images/album/fwd.jpg" alt="' . $next_nick . '" border="0"></a>';
    }
    echo '</td>';
    echo '</tr>';
    echo '</table>';
    echo '</div>';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td colspan="2" align="center" valign="middle">';
    if ($disabled == false) {
        echo '<img src="' . URL . '/upload/' . $album_id . '">';
    } else {
        echo '<img src="' . URL . '/images/album/disabled.jpg">';
    }
    echo '</td>';
    echo '</tr>';
    if (empty($location)) {
        $location = 'N/A';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">Location:</td><td>' . $location . '</td>';
    echo '</tr>';
    if (empty($email)) {
        $email = 'N/A';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">eMail:</td><td>' . $email . '</td>';
    echo '</tr>';
    if (empty($website)) {
        $website = 'N/A';
    } else {
        $website = '<a href="' . $website . '" target="_new">' . $website . '</a>';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">Website:</td><td>' . $website . '</td>';
    echo '</tr>';
    echo '<tr>';
    if (!empty($day) && !empty($month) && !empty($year)) {
//.........这里部分代码省略.........
开发者ID:smrealms,项目名称:smrv2.0,代码行数:101,代码来源:album_functions.php

示例9: shuffle

            // get one good
            $good_ids[] = draw_rand_array(&$curr_goods[$good_class], 1);
        }
        // Make sure everything is good and random
        shuffle($good_ids);
        // We rig matters so that there is at least one good bought/sold
        // and the number sold doesn't hugely outweigh the number sold
        // since we can only fit 9 on the local/galaxy map without exploding the table
        $num_goods = count($good_ids);
        $range_low = 1 + floor($num_goods * 0.35);
        $range_high = floor($num_goods * 0.67);
        $num_sold = mt_rand($range_low, $range_high);
        $bought = $sold = 0;
        for ($i = 0; $i < $num_goods; ++$i) {
            if ($i < $num_sold) {
                $transaction = 'Sell';
            } else {
                $transaction = 'Buy';
            }
            $good_id = $good_ids[$i];
            $db2->query('INSERT INTO port_has_goods
				(game_id, sector_id, good_id, transaction_type, amount)
				VALUES(' . $db2->escapeNumber($var['game_id']) . ', ' . $db2->escapeNumber($sector_id) . ', ' . $db2->escapeNumber($good_id) . ', ' . $db2->escapeString($transaction) . ', 0)');
        }
    }
}
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'universe_create_planets.php';
$container['game_id'] = $var['game_id'];
forward($container);
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:universe_create_ports_processing.php

示例10: channel_msg_sms_send

function channel_msg_sms_send($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!sms send ([^ ]+) (.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $recv = $msg[5];
        $msg = trim($msg[6]);
        echo_r('[SMS_SEND] by ' . $nick . ' in ' . $channel . ' for ' . $recv);
        if (($blacklist_reason = $account->isSmsBlacklisted()) !== false) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you are not allowed to send text messages via ' . IRC_BOT_NICK . '. Reason: ' . $blacklist_reason . EOL);
            return true;
        }
        // check if we know this user we try to send a text too
        $recv_account =& SmrAccount::getAccountByIrcNick($recv, true);
        if ($recv_account == null) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', I don\'t know a player that goes by the nick \'' . $recv . '\'.' . EOL);
            return true;
        }
        // do we have a cellphone number?
        if (strlen($recv_account->getCellPhone()) == 0) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', ' . $recv_account->getIrcNick() . ' has not provided a cell phone number.' . EOL);
            return true;
        }
        // do we have a msg
        if (empty($msg)) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you don\'t mind me asking what do you want to send to ' . $recv_account->getIrcNick() . '?' . EOL);
            return true;
        }
        // message too long?
        if (strlen($msg) > 160) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', the message you want to send contains more than 160 characters.' . EOL);
            return true;
        }
        // +--------------------------------------------+
        // | Copyright (c) 2007-2009 by MOBILANT.DE     |
        // +--------------------------------------------+
        $url = 'http://gw.mobilant.com';
        $request = '';
        $param = array();
        $param['key'] = SMS_GATEWAY_KEY;
        $param['message'] = $msg;
        // numbers like +177 will be (for some reason) 'corrected' to a german number because it's a common area code here
        // therefor support asked me to use 00-1-77 instad of +1-77
        $param['to'] = '00' . substr($recv_account->getCellPhone(), 1);
        //		$param['from'] = 'SMR';
        $param['route'] = 'direct';
        $param['debug'] = SMS_DEBUG;
        $param['message_id'] = '1';
        $param['dlr'] = '1';
        $param['response'] = '1';
        foreach ($param as $key => $val) {
            $request .= $key . '=' . urlencode($val);
            $request .= '&';
        }
        echo_r('Calling url: ' . $url . '?' . $request);
        // request url = send text
        $response = @file($url . '?' . $request);
        $response_code = intval($response[0]);
        $message_id = intval($response[1]);
        // insert log
        $db = new SmrMySqlDatabase();
        $db->query('INSERT INTO account_sms_log (account_id, time, receiver_id, receiver_cell, response_code, message_id)
					VALUES (' . $account->getAccountID() . ', ' . time() . ', ' . $recv_account->getAccountID() . ', ' . $db->escapeString($recv_account->getCellPhone()) . ', ' . $response_code . ', ' . $message_id . ')');
        // confirm sending
        if (SMS_DEBUG) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', sending SMS messages is currently disabled.' . EOL);
        } else {
            if ($response_code == 100) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your text message will be delivered to ' . $recv_account->getIrcNick() . ' immediately.' . EOL);
            } elseif ($response_code == 10) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown receiver number!' . EOL);
            } elseif ($response_code == 20) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown sender number!' . EOL);
            } elseif ($response_code == 30) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error in message!' . EOL);
            } elseif ($response_code == 40) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Unknown route!' . EOL);
            } elseif ($response_code == 50) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Identification failed!' . EOL);
            } elseif ($response_code == 60) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Insufficient funds! Please donate!' . EOL);
            } elseif ($response_code == 70) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Text message can\'t be delivered!' . EOL);
            } elseif ($response_code == 71) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Feature not possible!' . EOL);
            } elseif ($response_code == 80) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message: Error while delivering to SMS-C!' . EOL);
            } else {
                fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', there was an error while sending your text message' . EOL);
            }
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:97,代码来源:channel_msg_sms.php

示例11: forward

        $container['account_id'] = $album_id;
        forward($container);
        exit;
    }
    $db = new SmrMySqlDatabase();
    if (!isset($_GET['comment']) || empty($_GET['comment'])) {
        create_error_offline('Please enter a comment.');
    } else {
        $comment = $_GET['comment'];
    }
    // get current time
    $curr_time = TIME;
    $comment = word_filter($comment);
    $account->sendMessageToBox(BOX_ALBUM_COMMENTS, $comment);
    // check if we have comments for this album already
    $db->lockTable('album_has_comments');
    $db->query('SELECT MAX(comment_id) FROM album_has_comments WHERE album_id = ' . $db->escapeNumber($album_id));
    if ($db->nextRecord()) {
        $comment_id = $db->getField('MAX(comment_id)') + 1;
    } else {
        $comment_id = 1;
    }
    $db->query('INSERT INTO album_has_comments
				(album_id, comment_id, time, post_id, msg)
				VALUES (' . $db->escapeNumber($album_id) . ', ' . $db->escapeNumber($comment_id) . ', ' . $db->escapeNumber($curr_time) . ', ' . $db->escapeNumber($account->getAccountID()) . ', ' . $db->escapeString($comment) . ')');
    $db->unlock();
    header('Location: ' . URL . '/album/?' . get_album_nick($album_id));
    exit;
} catch (Exception $e) {
    handleException($e);
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:album_comment.php

示例12: 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');
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:60,代码来源:npc.php

示例13: server_msg_401

function server_msg_401($fp, $rdata)
{
    // :ice.coldfront.net 401 Caretaker MrSpock :No such nick/channel
    if (preg_match('/^:(.*) 401 ' . IRC_BOT_NICK . ' (.*) :No such nick\\/channel\\s/i', $rdata, $msg)) {
        $server = $msg[1];
        $nick = $msg[2];
        echo_r('[SERVER_401] ' . $server . ' said: "No such nick/channel" for ' . $nick);
        $db = new SmrMySqlDatabase();
        $db2 = new SmrMySqlDatabase();
        // get the user in question
        $db->query('SELECT * FROM irc_seen WHERE nick = ' . $db->escapeString($nick) . ' AND signed_off = 0');
        if ($db->nextRecord()) {
            $seen_id = $db->getField('seen_id');
            // maybe he left without us noticing, so we fix this now
            $db->query('UPDATE irc_seen SET ' . 'signed_off = ' . time() . ', ' . 'WHERE seen_id = ' . $seen_id);
        }
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:20,代码来源:server.php

示例14: channel_msg_op_response

function channel_msg_op_response($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!op (yes|no|maybe)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $response = strtoupper($msg[5]);
        echo_r('[OP_' . $response . '] by ' . $nick . ' in ' . $channel);
        // get the op info from db
        $db = new SmrMySqlDatabase();
        $db->query('SELECT 1
					FROM alliance_has_op
					WHERE alliance_id = ' . $player->getAllianceID() . '
						AND game_id = ' . $player->getGameID());
        if (!$db->nextRecord()) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your leader has not scheduled an OP.' . EOL);
            return true;
        }
        $db->query('REPLACE INTO alliance_has_op_response (alliance_id, game_id, account_id, response)
					VALUES (' . $player->getAllianceID() . ', ' . $player->getGameID() . ', ' . $player->getAccountID() . ', ' . $db->escapeString($response) . ')');
        fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', you have been added to the ' . $response . ' list.' . EOL);
        return true;
    }
    return false;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:26,代码来源:channel_msg_op.php

示例15: array

$count = 0;
//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;
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:keyword_search.php


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