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; }
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; }
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; }
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); } }
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; }
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; }
/** * 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; }
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_OUTPUT .= '</select>'; $PHP_OUTPUT .= '</td>'; } //$alliance_vs[] = $curr_alliance_id; } $PHP_OUTPUT .= '<td width=10% valign="top">None</td>'; $PHP_OUTPUT .= '</tr>'; //$db->query('SELECT * FROM alliance WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' ORDER BY alliance_kills DESC, alliance_name LIMIT 5'); foreach ($alliance_vs as $key => $id) { $PHP_OUTPUT .= '<tr>'; // get current alliance $curr_id = $id; if ($id > 0) { $curr_alliance =& SmrAlliance::getAlliance($id, $player->getGameID()); $db2->query('SELECT 1 FROM player WHERE alliance_id = ' . $db2->escapeNumber($curr_id) . ' AND game_id = ' . $db2->escapeNumber($player->getGameID()) . ' LIMIT 1'); $out = $db2->nextRecord(); $PHP_OUTPUT .= '<td width=10% valign="top"'; if ($player->getAllianceID() == $curr_alliance->getAllianceID()) { $PHP_OUTPUT .= ' class="bold"'; } if ($out) { $PHP_OUTPUT .= ' class="red"'; } $PHP_OUTPUT .= '>'; $container1 = array(); $container1['url'] = 'skeleton.php'; $container1['body'] = 'rankings_alliance_vs_alliance.php'; $container1['alliance_id'] = $curr_alliance->getAllianceID(); $PHP_OUTPUT .= create_link($container1, $curr_alliance->getAllianceName()); //$PHP_OUTPUT.=('.$db->escapeString($curr_alliance->getAllianceName()');
$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>"; }
} 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><<Back</b>"); print "<br>"; print "Here are the ranks of players by {$cat} {$action}<br><br>"; print_table(); print "<tr><th align=center>Rank</th><th align=center>Player</th><th align=center>{$cat} {$action}</th></tr>"; if ($cat == "<b>Money Donated to SMR</b>") { $db->query("SELECT account_id, sum(amount) as amount FROM account_donated " . "GROUP BY account_id ORDER BY amount DESC LIMIT 25"); } else { $db->query("SELECT account_id, {$row} as amount FROM {$table} {$row} > 0 ORDER BY amount DESC LIMIT 25"); } while ($db->next_record()) { $this_acc = new SMR_ACCOUNT(); $this_acc->get_by_id($db->f("account_id")); if ($db->f("account_id") == ".SmrSession::{$old_account_id}.") { $bold = " style=\"font-weight:bold;\""; } else { $bold = ""; } print "<tr>"; print "<td align=center{$bold}>" . $rank++ . "</td>"; //link to stat page $container = array();
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>'; } $PHP_OUTPUT .= '</table><br />';
<?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>';
<?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 "<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);*/ print "<tr>"; print "<td>{$construction_name}</td>"; print "<td>{$construction_description}</td>"; print "<td align=\"center\">"; print $planet->construction[$construction_id]; print "/";
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; }
<?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);
$planet = 2; //unknown level $level = 0; } } else { //no planet $planet = 0; $level = 0; } if ($planet > 0 || $race > 0) { $file .= addbyte($planet + $race); } if ($planet > 0) { $file .= addbyte($level); } $db3->query('SELECT * FROM warp WHERE game_id = ' . $game_id . ' AND (sector_id_1 = ' . $sector_id . ' OR sector_id_2 = ' . $sector_id . ') LIMIT 1'); if ($db3->nextRecord()) { $CurrByte = 128; } else { $CurrByte = 0; } // locations $db2->query('SELECT * FROM location NATURAL JOIN location_type WHERE game_id = ' . $game_id . ' AND sector_id = ' . $sector_id . ' LIMIT 1'); $CurrByte += $db2->getNumRows(); $file .= addbyte($CurrByte); // warp $db3->query('SELECT * FROM warp WHERE game_id = ' . $game_id . ' AND (sector_id_1 = ' . $sector_id . ' OR sector_id_2 = ' . $sector_id . ') LIMIT 1'); if ($db3->nextRecord()) { $warp_id = $db3->getField('sector_id_1') == $sector_id ? $db3->getField('sector_id_2') : $db3->getField('sector_id_1'); $file .= add2bytes($warp_id); }
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) . ' AND msg_read = ' . $db2->escapeBoolean(false) . ' AND receiver_delete = ' . $db2->escapeBoolean(false) . ' LIMIT 1'); $messageBox['HasUnread'] = $db2->getNumRows() != 0; $messageBox['MessageCount'] = 0; // get number of msges $db2->query('SELECT count(message_id) as message_count FROM message WHERE account_id = ' . $db2->escapeNumber($player->getAccountID()) . ' AND game_id = ' . $db2->escapeNumber($player->getGameID()) . ' AND message_type_id = ' . $db2->escapeNumber($message_type_id) . ' AND receiver_delete = ' . $db2->escapeBoolean(false)); if ($db2->nextRecord()) { $messageBox['MessageCount'] = $db2->getField('message_count'); } $container = create_container('skeleton.php', 'message_view.php'); $container['folder_id'] = $message_type_id;
// 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) { // do we do more damage than shields left?
<?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);
$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}"); if ($db2->next_record()) { print "You have donated " . $db2->f("amount") . " dollars to SMR.<br>"; } print "You have claimed " . $db->f("bounties_claimed") . " bounties.<br>"; print "You have claimed " . $db->f("bounty_amount_claimed") . " credits from bounties.<br>"; print "You have claimed " . $db->f("military_claimed") . " credits from military payment.<br>"; print "You have had a total of " . $db->f("bounty_amount_on") . " credits bounty placed on you.<br>"; print "You have done " . $db->f("player_damage") . " damage to other ships.<br>"; print "The total experience of traders you have killed is " . $db->f("traders_killed_exp") . ".<br>"; print "You have gained " . $db->f("kill_exp") . " experience from killing other traders.<br>"; print "You have used " . $db->f("turns_used") . " turns since your last death.<br>"; print "You have won " . $db->f("blackjack_win") . " credits from Blackjack.<br>"; print "You have lost " . $db->f("blackjack_lose") . " credits from Blackjack.<br>"; print "You have won " . $db->f("lotto") . " credits from the lotto.<br>"; print "You have had " . $db->f("drinks") . " drinks at the bar.<br>";
$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'])) { $db->query('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($var['id'])); $db->nextRecord();
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">'; echo $db->f("amount"); echo '</td><td class="button">'; $container["account_num"] = $db->f("anon_id");
$name = $db->getField('ship_name'); $race_id = 'R' . $db->getField('race_id'); $res = $db->getField('buyer_restriction'); if ($res == 1) { $align = '+'; } elseif ($res == 2) { $align = '-'; } else { $align = '0'; } $speed = $db->getField('speed'); $cost = $db->getField('cost'); $hard = $db->getField('hardpoint'); //assuem 10 for now its not implemented $mr = 10; $db3->query('SELECT * FROM hardware_type ORDER BY hardware_type_id'); $props = array(); while ($db3->nextRecord()) { $hard_id = $db3->getField('hardware_type_id'); $db2->query('SELECT * FROM ship_type_support_hardware WHERE ship_type_id = ' . $id . ' ORDER BY hardware_type_id AND hardware_type_id = ' . $hard_id); while ($db2->nextRecord()) { $props[$hard_id] = $db2->getField('max_amount'); } } $shields = $props[HARDWARE_SHIELDS]; $armour = $props[HARDWARE_ARMOUR]; $cargo = $props[HARDWARE_CARGO]; $combat = $props[HARDWARE_COMBAT]; $scouts = $props[HARDWARE_SCOUT]; $mines = $props[HARDWARE_MINE]; $scanner = $props[HARDWARE_SCANNER];
$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>'; $PHP_OUTPUT .= '<td' . ($db2->getBoolean('validated') ? '' : ' style="text-decoration:line-through;"') . '>' . $db2->getField('email') . ' (' . ($db2->getBoolean('validated') ? 'Valid' : 'Invalid') . ')</td>'; $PHP_OUTPUT .= '<td align="center"><input type="checkbox" name="disable_account[]" value="' . $curr_account_id . '"'; // check if this guy is maybe already disabled $db3->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($curr_account_id)); if ($isDisabled) { $PHP_OUTPUT .= ' checked'; } else { if ($action == 'Select All') { $PHP_OUTPUT .= ' checked'; } }
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'); $curr_login = $db->getField('login'); // check if this guy is already in $db2->query('SELECT player_name FROM player WHERE account_id = ' . $db2->escapeNumber($curr_account_id) . ' AND game_id = ' . $db2->escapeNumber($var['game_id'])); if (!$db2->nextRecord()) { $PHP_OUTPUT .= '<option value="' . $curr_account_id . '">' . $curr_login . '</option>'; } } } else { $PHP_OUTPUT .= '<option value="1">MrSpock</option>'; $player_name = 'MrSpock'; $readonly = ' readonly'; } $PHP_OUTPUT .= '</select><br /><br /><br />'; $PHP_OUTPUT .= 'Player Name:<br /><br />'; $PHP_OUTPUT .= '<input type="text" name="player_name" value="' . $player_name . '" id="InputFields" style="padding-left:10px;"' . $readonly . '><br /><br /><br />'; $PHP_OUTPUT .= 'Player Race:<br /><br />'; $PHP_OUTPUT .= '<select name="race_id" id="InputFields" style="padding-left:10px;">';
<?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;
$planet = 2; //unknown level $level = 0; } } else { //no planet $planet = 0; $level = 0; } if ($planet > 0 || $race > 0) { $file .= addbyte($planet + $race); } if ($planet > 0) { $file .= addbyte($level); } $db3->query("SELECT * FROM warp WHERE game_id = {$game_id} AND (sector_id_1 = {$sector_id} OR sector_id_2 = {$sector_id}) LIMIT 1"); if ($db3->next_record()) { $CurrByte = 128; } else { $CurrByte = 0; } // locations $db2->query("SELECT * FROM location NATURAL JOIN location_type WHERE game_id = {$game_id} AND sector_id = {$sector_id} LIMIT 1"); $CurrByte += $db2->nf(); $file .= addbyte($CurrByte); // warp $db3->query("SELECT * FROM warp WHERE game_id = {$game_id} AND (sector_id_1 = {$sector_id} OR sector_id_2 = {$sector_id}) LIMIT 1"); if ($db3->next_record()) { $warp_id = $db3->f("sector_id_1") == $sector_id ? $db3->f("sector_id_2") : $db3->f("sector_id_1"); $file .= add2bytes($warp_id); }
<?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);