• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

PHP SmrMySqlDatabase类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: notice_nickserv_registered_user

function notice_nickserv_registered_user($fp, $rdata)
{
    // :[email protected] NOTICE Caretaker
    if (preg_match('/^:[email protected] 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_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;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:25,代码来源:ship.php


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


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


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


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


示例7: channel_part

function channel_part($fp, $rdata)
{
    // :[email protected] PART #smr-irc :
    // :[email protected] 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


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


示例9: get_file_loc

<?php

require_once get_file_loc('SmrAlliance.class.inc');
$template->assign('PageTopic', 'Alliance VS Alliance Rankings');
require_once get_file_loc('menu.inc');
create_ranking_menu(1, 3);
$db2 = new SmrMySqlDatabase();
$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'rankings_alliance_vs_alliance.php';
$PHP_OUTPUT .= create_echo_form($container);
if (isset($_REQUEST['alliancer'])) {
    SmrSession::updateVar('alliancer', $_REQUEST['alliancer']);
}
$alliancer = $var['alliancer'];
$PHP_OUTPUT .= '<div align="center">';
$PHP_OUTPUT .= '<p>Here are the rankings of alliances vs other alliances<br />';
$PHP_OUTPUT .= 'Click on an alliances name for more detailed death stats.</p>';
$PHP_OUTPUT .= '<table class="standard" width="95%">';
$PHP_OUTPUT .= '<tr>';
$PHP_OUTPUT .= '<th rowspan="9">Killed</th><th colspan="8">Killers</th></tr><tr><td></td>';
if (empty($alliancer)) {
    $alliance_vs = array();
    $db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY alliance_kills DESC, alliance_name LIMIT 5');
    while ($db->nextRecord()) {
        $alliance_vs[] = $db->getField('alliance_id');
    }
    //$PHP_OUTPUT.=('empty '.$alliancer);
} else {
    $alliance_vs = $alliancer;
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:rankings_alliance_vs_alliance.php


示例10: player_visited_port

        $port_info[$good_id] = $transaction;
    }
    //insert the last port
    $db2->query("REPLACE INTO player_visited_port (account_id, game_id, sector_id, visited, port_info) " . "VALUES({$account_id}, {$game_id}, {$current_sector_id}, {$current_time}, '" . addslashes(serialize($port_info)) . "')");
    //offer another drink and such
    print "<div align=center>Galaxy Info has been added.  Enjoy!</div><br>";
    include get_file_loc("bar_opening.php");
} else {
    //find what gal they want
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "bar_main.php";
    $container["script"] = "bar_galmap_buy.php";
    $container["process"] = "yes";
    print "<div align=center>What galaxy do you want info on?<br>";
    print_form($container);
    print "<select type=select name=gal_id>";
    print "<option value=0>[Select a galaxy]</option>";
    $db->query("SELECT galaxy_id FROM sector WHERE game_id = {$player->game_id} GROUP BY galaxy_id ORDER BY galaxy_id ASC");
    $db2 = new SmrMySqlDatabase();
    while ($db->next_record()) {
        $gal_id = $db->f("galaxy_id");
        $db2->query("SELECT * FROM galaxy WHERE galaxy_id = {$gal_id}");
        if ($db2->next_record()) {
            print "<option value={$gal_id}>" . $db2->f("galaxy_name") . "</option>";
        }
    }
    print "</select><br>";
    print_submit("Buy the map");
    print "</form></div>";
}
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:bar_galmap_buy.php


示例11: SMR_HISTORY_DB

        $row .= $two;
        break;
    }
}
//for future when we have curr game stats
if (isset($game_id)) {
    $table = "player_has_stats_cache WHERE game_id = {$game_id} AND";
    $db2 = new SMR_HISTORY_DB();
    $db2->query("SELECT * FROM game WHERE game_id = {$game_id}");
    //if next record we have an old game so we query the hist db
    if ($db2->next_record()) {
        $db = new SMR_HISTORY_DB();
        $past = "Yes";
        $table = "player_has_stats WHERE game_id = {$game_id} AND";
    } else {
        $db = new SmrMySqlDatabase();
    }
} else {
    $table = "account_has_stats_cache WHERE";
}
print "<div align=center>";
print_topic("Hall of Fame - {$cat} {$action}");
$container = array();
$container["url"] = "skeleton.php";
$container["body"] = "hall_of_fame_new.php";
if (isset($game_id)) {
    $container["game_id"] = $game_id;
}
print_link($container, "<b>&lt;&lt;Back</b>");
print "<br>";
print "Here are the ranks of players by {$cat} {$action}<br><br>";
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:hall_of_fame_new_detail.php


示例12: SmrMySqlDatabase

            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>Player is already blacklisted.';
            break;
        case 3:
            $PHP_OUTPUT .= '<span class="yellow">' . $_REQUEST['PlayerName'] . '</span> has been added to your blacklist.';
            break;
        case 4:
            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>No entries selected for deletion.';
            break;
        default:
            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>Unknown error event.';
            break;
    }
    $PHP_OUTPUT .= '<br /><br />';
}
$PHP_OUTPUT .= '<h2>Blacklisted Players</h2><br />';
$db = new SmrMySqlDatabase();
$db->query('SELECT p.player_name, p.game_id, b.entry_id FROM player p JOIN message_blacklist b ON p.account_id = b.blacklisted_id AND b.game_id = p.game_id WHERE b.account_id=' . $db->escapeNumber($player->getAccountID()) . ' ORDER BY p.game_id, p.player_name');
if ($db->getNumRows()) {
    $container = array();
    $container['url'] = 'message_blacklist_del.php';
    $form = create_form($container, 'Remove Selected');
    $PHP_OUTPUT .= $form['form'];
    $PHP_OUTPUT .= '<table class="standard"><tr><th>Option</th><th>Name</th><th>Game ID</th>';
    while ($db->nextRecord()) {
        $row = $db->getRow();
        $PHP_OUTPUT .= '<tr>';
        $PHP_OUTPUT .= '<td class="center shrink"><input type="checkbox" name="entry_ids[]" value="' . $row['entry_id'] . '"></td>';
        $PHP_OUTPUT .= '<td>' . $row['player_name'] . '</td>';
        $PHP_OUTPUT .= '<td>' . $row['game_id'] . '</td>';
        $PHP_OUTPUT .= '</tr>';
    }
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:message_blacklist.php


示例13: SmrMySqlDatabase

<?php

$template->assign('PageTopic', 'Word Filter');
$db = new SmrMySqlDatabase();
$db->query('SELECT * FROM word_filter');
if (isset($var['error'])) {
    switch ($var['error']) {
        case 1:
            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>Invalid input.';
            break;
        case 2:
            $PHP_OUTPUT .= '<span class="yellow">' . strtoupper(trim($_REQUEST['Word'])) . '</span> will now be replaced with <span class="yellow">' . strtoupper(trim($_REQUEST['WordReplacement'])) . '</span>.';
            break;
        case 3:
            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>No entries selected for deletion.';
            break;
        default:
            $PHP_OUTPUT .= '<span class="red bold">ERROR: </span>Unknown error event.';
            break;
    }
    $PHP_OUTPUT .= '<br /><br />';
}
$PHP_OUTPUT .= '<h2>Filtered Words</h2><br />';
if (!$db->getNumRows()) {
    $PHP_OUTPUT .= 'No words are currently being filtered.<br /><br />';
} else {
    $container = array();
    $container['url'] = 'word_filter_del.php';
    $form = create_form($container, 'Remove Selected');
    $PHP_OUTPUT .= $form['form'];
    $PHP_OUTPUT .= '<table class="standard"><tr><th>Option</th><th>Word</th><th>Replacement</th></tr>';
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:word_filter.php


示例14: realpath

<?php

try {
    echo '<pre>';
    // global config
    require_once realpath(dirname(__FILE__)) . '/../../htdocs/config.inc';
    // bot config
    require_once TOOLS . 'npc/config.specific.php';
    // needed libs
    require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
    require_once LIB . 'Default/Globals.class.inc';
    $db = new SmrMySqlDatabase();
    debug('Script started');
    define('SCRIPT_ID', $db->getInsertID());
    $db->query('UPDATE npc_logs SET script_id=' . SCRIPT_ID . ' WHERE log_id=' . SCRIPT_ID);
    define('NPCScript', true);
    $descriptorSpec = array(0 => array("pipe", "r"), 1 => array("pipe", "w"));
    $engine = proc_open(UCI_CHESS_ENGINE, $descriptorSpec, $pipes);
    $toEngine =& $pipes[0];
    $fromEngine =& $pipes[1];
    function readFromEngine($block = true)
    {
        global $fromEngine;
        stream_set_blocking($fromEngine, $block == true ? 1 : 0);
        while (($s = fgets($fromEngine)) !== false) {
            debug('<-- ' . trim($s));
            stream_set_blocking($fromEngine, 0);
        }
    }
    function writeToEngine($s, $block = true, $read = true)
    {
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:chess.php


示例15: SmrMySqlDatabase

print "<p>";
print "<div align=\"center\">";
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<th>Type</th>";
print "<th>Description</th>";
print "<th>Current</th>";
print "<th>Cost</th>";
print "<th>Build</th>";
print "</tr>";
// get game speed
$db->query("SELECT * FROM game WHERE game_id = {$player->game_id}");
if ($db->next_record()) {
    $game_speed = $db->f("game_speed");
}
$db2 = new SmrMySqlDatabase();
$db->query("SELECT * FROM planet_construction ORDER BY construction_id");
while ($db->next_record()) {
    $construction_id = $db->f("construction_id");
    $construction_name = $db->f("construction_name");
    $construction_description = $db->f("construction_description");
    $db2->query("SELECT * FROM planet_cost_credits WHERE construction_id = {$construction_id}");
    if ($db2->next_record()) {
        $cost = $db2->f("amount");
    }
    /*$container = array();
    	$container["url"] = "planet_construction_processing.php";
    	$container["construction_id"] = $construction_id;
    	$container["cost"] = $cost;
    
    	print_form($container);*/
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:planet_construction.php


示例16: 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


示例17: create_container

<?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);
开发者ID:smrealms,项目名称:smrv2.0,代码行数:25,代码来源:word_filter_add.php


示例18: addbyte

    } else {
        $file .= addbyte(9);
    }
    //gal size
    $file .= addbyte(sqrt($db->getField('num_sec')));
    $file .= addbyte(sqrt($db->getField('num_sec')));
}
//planet definitions (num of, [size of name, name])
$file .= addbyte(2);
$file .= addbyte(8);
$file .= 'Friendly';
$file .= addbyte(5);
$file .= 'Enemy';
//done with all header info
$db2 = new SmrMySqlDatabase();
$db3 = new SmrMySqlDatabase();
$db->query('SELECT * FROM sector WHERE game_id = ' . $game_id . ' ORDER BY sector_id');
while ($db->nextRecord()) {
    $sector_id = $db->getField('sector_id');
    $db2->query('SELECT * FROM player_visited_sector WHERE sector_id = ' . $sector_id . ' AND game_id = ' . $game_id . ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
    if ($db2->getNumRows() > 0) {
        $CurrByte = 3;
        $up = $db->getField('link_up');
        $db2->query('SELECT * FROM player_visited_sector WHERE sector_id = ' . $up . ' AND game_id = ' . $game_id . ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
        if ($db2->getNumRows() == 0 && $up != 0) {
            $CurrByte += 128;
        }
        $right = $db->getField('link_right');
        $db2->query('SELECT * FROM player_visited_sector WHERE sector_id = ' . $right . ' AND game_id = ' . $game_id . ' AND account_id = ' . $db->escapeNumber($player->getAccountID()) . ' LIMIT 1');
        if ($db2->getNumRows() == 0 && $right != 0) {
            $CurrByte += 64;
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:mgu_create.php


示例19: get_file_loc

<?php

require_once get_file_loc('menu.inc');
create_message_menu();
if (!isset($var['folder_id'])) {
    $template->assign('PageTopic', 'View Messages');
    $db2 = new SmrMySqlDatabase();
    require_once get_file_loc('council.inc');
    $db->query('SELECT 1 FROM message
				WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
					AND message_type_id = ' . $db->escapeNumber(MSG_POLITICAL) . '
					AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
					AND receiver_delete = ' . $db->escapeBoolean(false) . '
				LIMIT 1');
    if ($db->getNumRows() || $player->isOnCouncil()) {
        $db->query('SELECT * FROM message_type
					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) . '
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:message_view.php


示例20: array

 $atts[] = $curr_att_id;
 // reduce his relations
 $curr_attacker->get_relations();
 $curr_attacker->relations[$port->race_id] -= 5;
 if ($curr_attacker->relations[$port->race_id] < -500) {
     $curr_attacker->relations[$port->race_id] = -500;
 }
 // save what we got so far
 $curr_attacker->update();
 // disable cloak
 $curr_attacker_ship->disable_cloak();
 // the damage this attacker is going to do
 $attacker_damage = 0;
 // and his message array
 $damage_msg = array();
 $weapon = new SmrMySqlDatabase();
 $weapon->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$curr_attacker->account_id} AND " . "game_id = {$curr_attacker->game_id} " . "ORDER BY order_id");
 // iterate over all existing weapons
 while ($weapon->next_record()) {
     //vars
     $weapon_name = $weapon->f("weapon_name");
     $shield_damage = $weapon->f("shield_damage");
     $armor_damage = $weapon->f("armor_damage");
     $accuracy = $weapon->f("accuracy");
     // calc accuracy for this weapon
     $hit = round($accuracy + $curr_attacker->level_id - $port->level / 2);
     // did we hit with this weapon?
     if (mt_rand(0, 100) < $hit) {
         // does the port has shields?
         if ($port->shields > 0) {
             if ($shield_damage > 0) {
开发者ID:smrealms,项目名称:smrv2.0,代码行数:31,代码来源:port_attack_processing.php



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
PHP SmrSession类代码示例发布时间:2022-05-23
下一篇:
PHP Smarty_Template_Source类代码示例发布时间:2022-05-23
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap