Beispiel #1
0
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;
}
Beispiel #2
0
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;
}
Beispiel #3
0
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;
}
Beispiel #4
0
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;
}
Beispiel #5
0
/**
 * 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 = '******', ' . '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;
}
Beispiel #6
0
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);
    }
}
Beispiel #7
0
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;
}
Beispiel #8
0
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;
}
<?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;
}
Beispiel #10
0
        $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>";
}
        $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>";
Beispiel #12
0
            $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>';
    }
Beispiel #13
0
<?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>';
Beispiel #14
0
<?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)
    {
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);*/
Beispiel #16
0
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;
}
Beispiel #17
0
<?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);
Beispiel #18
0
    } 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;
Beispiel #19
0
<?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) . '
 $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) {
Beispiel #21
0
<?php

$template->assign('PageTopic', 'Log Console');
$loggedAccounts = array();
$db->query('SELECT account_id as account_id, login, count(*) as number_of_entries
			FROM account_has_logs
			JOIN account USING(account_id)
			GROUP BY account_id');
if ($db->getNumRows()) {
    $db2 = new SmrMySqlDatabase();
    while ($db->nextRecord()) {
        $accountID = $db->getInt('account_id');
        $loggedAccounts[$accountID] = array('AccountID' => $accountID, 'Login' => $db->getField('login'), 'TotalEntries' => $db->getInt('number_of_entries'), 'Checked' => is_array($var['account_ids']) && in_array($accountID, $var['account_ids']), 'Notes' => '');
        $db2->query('SELECT notes FROM log_has_notes WHERE account_id = ' . $db2->escapeNumber($accountID));
        if ($db2->nextRecord()) {
            $loggedAccounts[$accountID]['Notes'] = nl2br($db2->getField('notes'));
        }
    }
    // put hidden fields in for log type to have all fields selected on next page.
    $logTypes = array();
    $db->query('SELECT log_type_id FROM log_type');
    while ($db->nextRecord()) {
        $logTypes[] = $db->getInt('log_type_id');
    }
    $template->assignByRef('LogTypes', $logTypes);
    $template->assign('LogConsoleFormHREF', SmrSession::getNewHREF(create_container('skeleton.php', 'log_console_detail.php')));
    $template->assign('AnonAccessHRE', SmrSession::getNewHREF(create_container('skeleton.php', 'log_anonymous_account.php')));
}
$template->assignByRef('LoggedAccounts', $loggedAccounts);
Beispiel #22
0
print "You have <font color=\"red\">{$kills}</font> kills and <font color=\"red\">{$exp}</font> traded experience<br><br>";
print "You are ranked as a <font size=\"4\" color=\"greenyellow\">{$rank_name}</font> player.<p><br>";
$db->query("SELECT * FROM rankings");
$i = 0;
while ($db->next_record()) {
    if ($i > 1) {
        print " OR " . $db->f(experience_needed) . " experience OR " . $db->f(kills_needed) . " kills.";
    }
    if ($i > 0) {
        print "<br>";
    }
    print $db->f(rankings_name) . " - ";
    print $db->f(kills_needed) . " kills and " . $db->f(experience_needed) . " experience";
    $i++;
}
$db2 = new SmrMySqlDatabase();
print "<br><br>";
$db->query("SELECT * FROM account_has_stats WHERE account_id = {$account->account_id}");
if ($db->next_record()) {
    print "<b>Extended Stats</b><br>";
    print "You have joined " . $db->f("games_joined") . " games.<br>";
    print "You have busted " . $db->f("planet_busts") . " planets.<br>";
    print "You have busted a total of " . $db->f("planet_bust_levels") . " combined levels on planets.<br>";
    print "You have raided " . $db->f("port_raids") . " ports.<br>";
    print "You have raided a total of " . $db->f("port_raid_levels") . " combined levels of ports.<br>";
    print "You have done " . $db->f("planet_damage") . " damage to planets.<br>";
    print "You have done " . $db->f("port_damage") . " damage to ports.<br>";
    print "You have explored " . $db->f("sectors_explored") . " sectors.<br>";
    print "You have died " . $db->f("deaths") . " times.<br>";
    print "You have traded " . $db->f("goods_traded") . " goods.<br>";
    $db2->query("SELECT sum(amount) as amount FROM account_donated WHERE account_id = {$account->account_id}");
<?php

$template->assign('PageTopic', 'Viewing Articles');
require_once get_file_loc('menu.inc');
create_galactic_post_menu();
$db2 = new SmrMySqlDatabase();
if (isset($var['news'])) {
    $db->query('INSERT INTO news (game_id, time, news_message, type) ' . 'VALUES(' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber(TIME) . ', ' . $db->escape_string($var['news'], false) . ', \'BREAKING\')');
}
$db->query('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()));
if ($db->getNumRows()) {
    $PHP_OUTPUT .= 'It is your responsibility to make sure ALL HTML tags are closed!<br />';
    $PHP_OUTPUT .= 'You have the following articles to view.<br /><br />';
} else {
    $PHP_OUTPUT .= 'There are no articles to view';
}
while ($db->nextRecord()) {
    $db2->query('SELECT * FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($db->getInt('article_id')));
    if (!$db2->nextRecord()) {
        $title = stripslashes($db->getField('title'));
        $writter =& SmrPlayer::getPlayer($db->getField('writer_id'), $player->getGameID());
        $container = array();
        $container['url'] = 'skeleton.php';
        $container['body'] = 'galactic_post_view_article.php';
        $container['id'] = $db->getField('article_id');
        $PHP_OUTPUT .= create_link($container, '<span class="yellow">' . $title . '</span> written by ' . $writter->getPlayerName());
        $PHP_OUTPUT .= '<br />';
    }
}
$PHP_OUTPUT .= '<br /><br />';
if (isset($var['id'])) {
Beispiel #24
0
		</tr>
	</table>
	<br>';
    echo $form['submit'];
    echo '</form>';
    $db->query('SELECT * FROM anon_bank 
				WHERE owner_id=' . $player->account_id . '
				AND game_id=' . $player->game_id);
    if ($db->nf()) {
        echo '<br><h2>Your accounts</h2><br>';
        echo '<div align=center>';
        echo '<table cellspacing="0" cellpadding="0" class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
        $container = array();
        $container["url"] = "skeleton.php";
        $container["body"] = "bank_anon.php";
        $db2 = new SmrMySqlDatabase();
        while ($db->next_record()) {
            $db2->query('SELECT MAX(time) FROM anon_bank_transactions
						WHERE game_id=' . $player->game_id . '
						AND anon_id=' . $db->f('anon_id') . ' LIMIT 1');
            echo '<tr><td class="shrink center">';
            echo $db->f("anon_id");
            echo '</td><td>';
            echo $db->f("password");
            echo '</td><td class="shrink nowrap">';
            if ($db2->next_record() && $db2->f('MAX(time)')) {
                echo date('n/j/Y g:i:s A', $db2->f('MAX(time)'));
            } else {
                echo 'No transactions';
            }
            echo '</td><td class="right shrink">';
Beispiel #25
0
<?php

require_once get_file_loc('SmrPlanet.class.inc');
$db2 = new SmrMySqlDatabase();
$db3 = new SmrMySqlDatabase();
$game_id = $_REQUEST['game_id'];
//first get file name
$file = Globals::getGameName($game_id) . '.txt';
//we need to make a file for the SMC thing.
header('Content-Type: text/plain; charset=ISO-8859-1');
header('Content-Disposition: attachment; filename="' . $file . '"');
header('Content-transfer-encoding: base64');
//game heading and info
echo '[GAME]' . EOL;
echo $game_id . '=' . Globals::getGameName($game_id) . EOL;
//get races
echo '[RACES]' . EOL;
$db->query('SELECT * FROM race ORDER BY race_id');
while ($db->nextRecord()) {
    $id = $db->getField('race_id');
    $name = $db->getField('race_name');
    echo 'R' . $id . '=' . $name . EOL;
}
//galaxies
echo '[GALAXIES]' . EOL;
$i = 1;
$gameGals =& SmrGalaxy::getGameGalaxies($game_id);
foreach ($gameGals as &$gameGal) {
    echo 'GAL' . $i . '=' . $gameGal->getName() . ',' . $gameGal->getWidth() . ',' . $gameGal->getHeight() . EOL;
    $i++;
}
Beispiel #26
0
<?php

$template->assign('PageTopic', 'Password Checker');
// create account object
$db2 = new SmrMySqlDatabase();
$db3 = new SmrMySqlDatabase();
$db->query('SELECT count(password) as pwd_count, password FROM account
			GROUP BY password
			HAVING pwd_count > 1
			ORDER BY pwd_count DESC');
if ($db->getNumRows() > 0) {
    $PHP_OUTPUT .= create_echo_form(create_container('skeleton.php', 'password_check.php'));
    $PHP_OUTPUT .= create_submit('Select All');
    $PHP_OUTPUT .= '</form>';
    $PHP_OUTPUT .= create_echo_form(create_container('password_check_processing.php', ''));
    $PHP_OUTPUT .= '<table>';
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<th>ID</th>';
    $PHP_OUTPUT .= '<th>Login</th>';
    $PHP_OUTPUT .= '<th>eMail</th>';
    $PHP_OUTPUT .= '<th>Action</th>';
    $PHP_OUTPUT .= '</tr>';
    while ($db->nextRecord()) {
        $db2->query('SELECT * FROM account WHERE password = '******'password')));
        while ($db2->nextRecord()) {
            $curr_account_id = $db2->getField('account_id');
            $db3->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($curr_account_id) . ' LIMIT 1');
            $isDisabled = $db3->getNumRows() > 0;
            $PHP_OUTPUT .= '<tr' . ($isDisabled ? ' class="red"' : '') . '>';
            $PHP_OUTPUT .= '<td>' . $db2->getField('account_id') . '</td>';
            $PHP_OUTPUT .= '<td>' . $db2->getField('login') . '</td>';
$db->query('SELECT * FROM game WHERE game_id = ' . $db->escapeNumber($var['game_id']));
if ($db->nextRecord()) {
    $PHP_OUTPUT .= '<dt class="bold">Game<dt><dd>' . $db->getField('game_name') . '</dd>';
}
$PHP_OUTPUT .= '<dt class="bold">Task:<dt><dd>Adding admins</d>';
$PHP_OUTPUT .= '<dt class="bold">Description:<dt><dd style="width:50%;">';
$PHP_OUTPUT .= 'The universe is up and running so far. Here you have the chance to put all important people in the order you want! MrSpock has to be always the first tho. *fg*</dd>';
$PHP_OUTPUT .= '<dd>**DO NOT FORGET TO ADD ACCOUNT #' . ACCOUNT_ID_NHL . ' (Newbie Help Leader)**</dd>';
$PHP_OUTPUT .= '</dl>';
$container = array();
$container['url'] = 'universe_create_admin_processing.php';
$container['game_id'] = $var['game_id'];
$PHP_OUTPUT .= create_echo_form($container);
$PHP_OUTPUT .= '<p>&nbsp;</p>';
$PHP_OUTPUT .= '<p>Please select the account to add:<br /><br />';
$db2 = new SmrMySqlDatabase();
$PHP_OUTPUT .= '<select name="admin_id" id="InputFields" style="padding-left:10px;">';
// check if mrspock was created
$db->query('SELECT player_name
			FROM player
			WHERE account_id = 1
				AND game_id = ' . $db->escapeNumber($var['game_id']));
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');
<?php

$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'message_blacklist.php';
if (!isset($_REQUEST['PlayerName']) && !isset($var['account_id'])) {
    $container['error'] = 1;
    forward($container);
    exit;
}
if (isset($var['account_id'])) {
    $blacklisted_id = $var['account_id'];
} else {
    $player_name = mysql_real_escape_string($_REQUEST['PlayerName']);
    $db = new SmrMySqlDatabase();
    $db->query('SELECT account_id FROM player WHERE player_name=' . $db->escapeString($player_name) . ' AND game_id=' . $db->escapeNumber($player->getGameID()) . ' LIMIT 1');
    if (!$db->nextRecord()) {
        $container['error'] = 1;
        forward($container);
        exit;
    }
    $blacklisted_id = $db->getField('account_id');
}
$db->query('SELECT account_id FROM message_blacklist WHERE account_id=' . $db->escapeNumber($player->getAccountID()) . ' AND blacklisted_id=' . $db->escapeNumber($blacklisted_id) . ' AND game_id=' . $db->escapeNumber($player->getGameID()) . ' LIMIT 1');
if ($db->nextRecord()) {
    $container['error'] = 2;
    forward($container);
    exit;
}
$db->query('INSERT INTO message_blacklist (game_id,account_id,blacklisted_id) VALUES (' . $db->escapeNumber($player->getGameID()) . ',' . $db->escapeNumber($player->getAccountID()) . ',' . $db->escapeNumber($blacklisted_id) . ')');
$container['error'] = 3;
Beispiel #29
0
    } else {
        $file .= addbyte(9);
    }
    //gal size
    $file .= addbyte(sqrt($db->f("num_sec")));
    $file .= addbyte(sqrt($db->f("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->next_record()) {
    $sector_id = $db->f("sector_id");
    $db2->query("SELECT * FROM player_visited_sector WHERE sector_id = {$sector_id} AND game_id = {$game_id} AND account_id = {$player->account_id} LIMIT 1");
    if ($db2->nf() > 0) {
        $CurrByte = 3;
        $up = $db->f("link_up");
        $db2->query("SELECT * FROM player_visited_sector WHERE sector_id = {$up} AND game_id = {$game_id} AND account_id = {$player->account_id} LIMIT 1");
        if ($db2->nf() == 0 && $up != 0) {
            $CurrByte += 128;
        }
        $right = $db->f("link_right");
        $db2->query("SELECT * FROM player_visited_sector WHERE sector_id = {$right} AND game_id = {$game_id} AND account_id = {$player->account_id} LIMIT 1");
        if ($db2->nf() == 0 && $right != 0) {
            $CurrByte += 64;
<?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);