Exemplo n.º 1
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;
}
Exemplo n.º 2
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;
}
Exemplo n.º 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;
}
Exemplo n.º 4
0
function channel_msg_seedlist_add($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!seedlist add (.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $sectors = explode(' ', $msg[5]);
        echo_r('[SEEDLIST_ADD] by ' . $nick . ' in ' . $channel);
        // check if $nick is leader
        if (!$player->isAllianceLeader(true)) {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', only the leader of the alliance manages the seedlist.' . EOL);
            return true;
        }
        foreach ($sectors as $sector) {
            // see if the sector is numeric
            if (!is_numeric($sector)) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors all need to be numeric. Example: !seedlist add 1537' . EOL);
                return true;
            }
        }
        $db = new SmrMySqlDatabase();
        foreach ($sectors as $sector) {
            // check if the sector is a part of the game
            $db->query('SELECT sector_id
						FROM sector
						WHERE game_id = ' . $player->getGameID() . '
							AND  sector_id = ' . $db->escapeNumber($sector));
            if (!$db->nextRecord()) {
                fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' does not exist in current game.' . EOL);
                continue;
            }
            // check if the given sector is already part of the seed list
            $db->query('SELECT sector_id
						FROM alliance_has_seedlist
						WHERE alliance_id = ' . $player->getAllianceID() . '
							AND game_id = ' . $player->getGameID() . '
							AND sector_id = ' . $db->escapeNumber($sector));
            if ($db->nextRecord()) {
                //				fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' is already in the seedlist.' . EOL);
                continue;
            }
            // add sector to db
            $db->query('INSERT INTO alliance_has_seedlist
						(alliance_id, game_id, sector_id)
						VALUES (' . $player->getAllianceID() . ', ' . $player->getGameID() . ', ' . $db->escapeNumber($sector) . ')');
            //			fputs($fp, 'PRIVMSG ' . $channel . ' :The sector ' . $sector . ' has been added.' . EOL);
        }
        fputs($fp, 'PRIVMSG ' . $channel . ' :The sectors have been added.' . EOL);
        return true;
    }
    return false;
}
Exemplo n.º 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;
}
Exemplo n.º 6
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;
}
Exemplo n.º 7
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);
    }
}
Exemplo n.º 8
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;
}
Exemplo n.º 9
0
//array for mb so we dont duplicate
$mb_msgs = array();
while ($db->nextRecord()) {
    //search every message on webboards for each word first
    $id = $db->getField('id');
    $word = $db->getField('keyword');
    $db2->query('SELECT * FROM alliance_thread WHERE sender_id != 0 AND text LIKE ' . $db2->escapeString('%' . $word . '%') . ' ORDER BY time DESC');
    while ($db2->nextRecord()) {
        //assume we arent skipping
        $skip = 'no';
        $bad = $db2->getField('text');
        $db3->query('SELECT * FROM mb_keywords WHERE assoc = ' . $db3->escapeNumber($id) . ' AND type = \'ignore\' AND `use` = 1');
        while ($db3->nextRecord()) {
            $word2 = $db3->getField('keyword');
            $db4->query('SELECT ' . $db->escapeString($bad) . ' LIKE ' . $db4->escapeString('%' . $word2 . '%'));
            $db4->nextRecord();
            if ($db4->getField(0)) {
                $skip = 'yes';
            }
        }
        if ($skip == 'yes') {
            continue;
        }
        //get info
        $game_id = $db2->getField('game_id');
        $alliance_id = $db2->getField('alliance_id');
        $thread_id = $db2->getField('thread_id');
        $reply_id = $db2->getField('reply_id');
        //put in an array
        $array_filler = $game_id . ',' . $alliance_id . ',' . $thread_id . ',' . $reply_id;
        //check if its already been done
Exemplo n.º 10
0
    // ********************************
    if (SmrSession::$account_id == 0) {
        if (isset($_REQUEST['loginType'])) {
            require_once LIB . 'Login/SocialLogin.class.inc';
            $socialLogin = new SocialLogin($_REQUEST['loginType']);
            if (!$socialLogin->isValid()) {
                $msg = 'Error validating login.';
                header('Location: ' . URL . '/login.php?msg=' . rawurlencode(htmlspecialchars($msg, ENT_QUOTES)));
                exit;
            }
            $loginType = $socialLogin->getLoginType();
            $authKey = $socialLogin->getUserID();
            $db->query('SELECT account_id,old_account_id FROM account JOIN account_auth USING(account_id)
						WHERE login_type = ' . $db->escapeString($loginType) . '
						   AND auth_key = ' . $db->escapeString($authKey) . ' LIMIT 1');
            if ($db->nextRecord()) {
                // register session
                SmrSession::$account_id = $db->getInt('account_id');
                SmrSession::$old_account_id = $db->getInt('old_account_id');
            } else {
                if ($socialLogin->getEmail() != null) {
                    $db->query('SELECT account_id,old_account_id FROM account ' . 'WHERE email = ' . $db->escapeString($socialLogin->getEmail()) . ' LIMIT 1');
                }
                if ($socialLogin->getEmail() != null && $db->nextRecord()) {
                    //Email already has an account so let's link.
                    $account =& SmrAccount::getAccount($db->getField('account_id'));
                    $account->addAuthMethod($socialLogin->getLoginType(), $socialLogin->getUserID());
                    $account->setValidated(true);
                    SmrSession::$account_id = $db->getField('account_id');
                    SmrSession::$old_account_id = $db->getField('old_account_id');
                } else {
Exemplo n.º 11
0
    if ($db->getNumRows()) {
        $PHP_OUTPUT .= '<br /><h2>Your accounts</h2><br />';
        $PHP_OUTPUT .= '<div align=center>';
        $PHP_OUTPUT .= '<table class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
        $container = create_container('skeleton.php', 'bank_anon.php');
        $db2 = new SmrMySqlDatabase();
        while ($db->nextRecord()) {
            $PHP_OUTPUT .= '<tr><td class="shrink center">';
            $PHP_OUTPUT .= $db->getInt('anon_id');
            $PHP_OUTPUT .= '</td><td>';
            $PHP_OUTPUT .= $db->getField('password');
            $PHP_OUTPUT .= '</td><td class="shrink noWrap">';
            $db2->query('SELECT MAX(time) FROM anon_bank_transactions
						WHERE game_id=' . $db2->escapeNumber($player->getGameID()) . '
						AND anon_id=' . $db2->escapeNumber($db->getInt('anon_id')) . ' LIMIT 1');
            if ($db2->nextRecord() && $db2->getInt('MAX(time)')) {
                $PHP_OUTPUT .= date(DATE_FULL_SHORT, $db2->getInt('MAX(time)'));
            } else {
                $PHP_OUTPUT .= 'No transactions';
            }
            $PHP_OUTPUT .= '</td><td class="right shrink">';
            $PHP_OUTPUT .= $db->getInt('amount');
            $PHP_OUTPUT .= '</td><td class="button">';
            $container['AccountNumber'] = $db->getInt('anon_id');
            $container['Password'] = $db->getField('password');
            $PHP_OUTPUT .= create_button($container, 'Access Account');
            $PHP_OUTPUT .= '</td></tr>';
        }
        $PHP_OUTPUT .= '</table></div><br /><br />';
    }
    $container = create_container('skeleton.php', 'bank_anon.php');
Exemplo n.º 12
0
if ($db->nextRecord()) {
    $PHP_OUTPUT .= '<option value="0">[please select]</option>';
    // get all accounts
    $db->query('SELECT account_id, login
				FROM account
				ORDER BY login');
    while ($db->nextRecord()) {
        // get current account id and login
        $curr_account_id = $db->getInt('account_id');
        $curr_login = $db->getField('login');
        // check if this guy is already in
        $db2->query('SELECT player_name
					 FROM player
					 WHERE account_id = ' . $db2->escapeNumber($curr_account_id) . '
						 AND game_id = ' . $db2->escapeNumber($var['game_id']));
        if (!$db2->nextRecord()) {
            $PHP_OUTPUT .= '<option value="' . $curr_account_id . '">' . $curr_login . '</option>';
        }
    }
} else {
    $PHP_OUTPUT .= '<option value="1">MrSpock</option>';
    $player_name = 'MrSpock';
    $readonly = ' readonly';
}
$PHP_OUTPUT .= '</select><br /><br /><br />';
$PHP_OUTPUT .= 'Player Name:<br /><br />';
$PHP_OUTPUT .= '<input type="text" name="player_name" value="' . $player_name . '" id="InputFields" style="padding-left:10px;"' . $readonly . '><br /><br /><br />';
$PHP_OUTPUT .= 'Player Race:<br /><br />';
$PHP_OUTPUT .= '<select name="race_id" id="InputFields" style="padding-left:10px;">';
//this prevents multiple races appearing when there is more than 1 game
$only = array();
Exemplo n.º 13
0
 $res = $db->getField('buyer_restriction');
 if ($res == 1) {
     $align = '+';
 } elseif ($res == 2) {
     $align = '-';
 } else {
     $align = '0';
 }
 $speed = $db->getField('speed');
 $cost = $db->getField('cost');
 $hard = $db->getField('hardpoint');
 //assuem 10 for now its not implemented
 $mr = 10;
 $db3->query('SELECT * FROM hardware_type ORDER BY hardware_type_id');
 $props = array();
 while ($db3->nextRecord()) {
     $hard_id = $db3->getField('hardware_type_id');
     $db2->query('SELECT * FROM ship_type_support_hardware WHERE ship_type_id = ' . $id . ' ORDER BY hardware_type_id AND hardware_type_id = ' . $hard_id);
     while ($db2->nextRecord()) {
         $props[$hard_id] = $db2->getField('max_amount');
     }
 }
 $shields = $props[HARDWARE_SHIELDS];
 $armour = $props[HARDWARE_ARMOUR];
 $cargo = $props[HARDWARE_CARGO];
 $combat = $props[HARDWARE_COMBAT];
 $scouts = $props[HARDWARE_SCOUT];
 $mines = $props[HARDWARE_MINE];
 $scanner = $props[HARDWARE_SCANNER];
 $cloak = $props[HARDWARE_CLOAK];
 $illus = $props[HARDWARE_ILLUSION];
Exemplo n.º 14
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);
<?php

$action = $_REQUEST['action'];
if ($action == 'Skip >>') {
    $container = create_container('skeleton.php', 'universe_create_ships.php');
    $container['game_id'] = $var['game_id'];
    forward($container);
}
$planet = $_REQUEST['planet'];
if (!isset($planet)) {
    create_error('Couldn\'t determine how many planets to add!');
}
$db2 = new SmrMySqlDatabase();
$db2->query('SELECT * FROM game WHERE game_id = ' . $db->escapeNumber($var['game_id']));
$db2->nextRecord();
$date = $db2->getField('start_date');
list($year, $month, $day) = explode('-', $date);
// adjust the time so it is game start time
$time = mktime(0, 0, 0, $month, $day, $year);
reset($planet);
foreach ($planet as $galaxy_id => $amount) {
    $count = 0;
    // get a sector with none port
    $db->query('SELECT * FROM sector
				WHERE game_id = ' . $db->escapeNumber($var['game_id']) . '
				AND galaxy_id = ' . $db->escapeNumber($galaxy_id) . '
				ORDER BY rand()');
    while ($count < $amount && $db->nextRecord()) {
        $sector_id = $db->getInt('sector_id');
        // does this sector have a fed beacon??
        $db2->query('SELECT * FROM location
Exemplo n.º 16
0
        reset($ip_numbers);
        array_multisort($ip_numbers, $account_numbers);
        $i = 0;
        while ($i < $amount) {
            $account_wanted = array_shift($account_numbers);
            $ip_wanted = array_shift($ip_numbers);
            $new_acc =& SmrAccount::getAccount($account_wanted);
            $last_acc =& SmrAccount::getAccount($last_acc_id);
            $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db2->escapeNumber($acc_id));
            if ($db2->getNumRows() && $db_ip != $last_ip) {
                continue;
            }
            $PHP_OUTPUT .= '<tr>';
            $PHP_OUTPUT .= '<td align=center>' . $new_acc->getLogin() . ' (' . $new_acc->getAccountID() . ')</td>';
            $PHP_OUTPUT .= '<td align=center>' . $ip_wanted . '</td>';
            if ($ip_wanted == $last_ip && !$db2->nextRecord()) {
                $PHP_OUTPUT .= '<td align=center><span class="red">MATCH w/ ' . $last_acc->getLogin() . '</span></td>';
            } elseif ($ip_wanted == $last_ip) {
                $PHP_OUTPUT .= '<td align=center><span class="red">(Already disabled) MATCH w/ ' . $last_acc->getLogin() . '</span></td>';
            } else {
                $PHP_OUTPUT .= '<td align=center>&nbsp;</td>';
            }
            $PHP_OUTPUT .= '<td><input type="checkbox" name="account_id[]" value="' . $new_acc->getAccountID() . '"></td>';
            $PHP_OUTPUT .= '</tr>';
            $i += 1;
            $last_acc_id = $new_acc->getAccountID();
            $last_ip = $ip_wanted;
        }
        $PHP_OUTPUT .= '</table>';
    }
}
Exemplo n.º 17
0
$PHP_OUTPUT .= '<th>Rank</th>';
$PHP_OUTPUT .= '<th>Race</th>';
$PHP_OUTPUT .= '<th>Total Experience</th>';
$PHP_OUTPUT .= '<th>Average Experience</th>';
$PHP_OUTPUT .= '<th>Total Traders</th>';
$PHP_OUTPUT .= '</tr>';
$rank = 0;
$db2 = new SmrMySqlDatabase();
$db->query('SELECT race_id, race_name, SUM(experience) as experience_sum, COUNT(*) as members FROM player JOIN race USING(race_id) WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' GROUP BY race_id ORDER BY experience_sum DESC');
while ($db->nextRecord()) {
    $rank++;
    $race_id = $db->getInt('race_id');
    $db2->query('SELECT * FROM player WHERE race_id = ' . $db2->escapeNumber($race_id) . ' AND game_id = ' . $db2->escapeNumber($player->getGameID()) . ' AND out_of_game = \'TRUE\'');
    if ($player->getRaceID() == $race_id) {
        $style = ' class="bold"';
    } elseif ($db2->nextRecord()) {
        $style = ' class="red"';
    } else {
        $style = '';
    }
    //	if ($db2->nextRecord()) $style .=
    $PHP_OUTPUT .= '<tr>';
    $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $rank . '</td>';
    $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $db->getField('race_name') . '</td>';
    $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $db->getInt('experience_sum') . '</td>';
    $PHP_OUTPUT .= '<td align="center"' . $style . '>' . round($db->getInt('experience_sum') / $db->getInt('members')) . '</td>';
    $PHP_OUTPUT .= '<td align="center"' . $style . '>' . $db->getInt('members') . '</td>';
    $PHP_OUTPUT .= '</tr>';
}
$PHP_OUTPUT .= '</table>';
$PHP_OUTPUT .= '</div>';
Exemplo n.º 18
0
 }
 $PHP_OUTPUT .= create_table();
 $PHP_OUTPUT .= '<tr><th align="center">Accounts</th><th>EMail</th><th>Most Common IP</th><th>Last Login</th><th>Exception</th><th>Closed</th><th>Option</th></tr>';
 foreach ($accountIDs as $currLinkAccId) {
     if (!is_numeric($currLinkAccId)) {
         continue;
     }
     //rare error where user modified their own cookie.  Fixed to not allow to happen in v2.
     $db2->query('SELECT account_id, login, email, validated, last_login, (SELECT ip FROM account_has_ip WHERE account_id = account.account_id GROUP BY ip ORDER BY COUNT(ip) DESC LIMIT 1) common_ip FROM account WHERE account_id = ' . $db2->escapeNumber($currLinkAccId) . ($skipUnusedAccs ? ' AND last_login > ' . $db2->escapeNumber(TIME - 86400 * 30) : ''));
     if ($db2->nextRecord()) {
         $currLinkAccLogin = $db2->getField('login');
     } else {
         continue;
     }
     $db3->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db2->escapeNumber($currLinkAccId));
     $isDisabled = $db3->nextRecord();
     $PHP_OUTPUT .= '<tr class="center' . ($isDisabled ? ' red' : '') . '">';
     //if ($echoMainAcc) $PHP_OUTPUT.=('<td rowspan='.$rows.' align=center>'.$currTabAccLogin.' ('.$currTabAccId.')</td>');
     $PHP_OUTPUT .= '<td>' . $currLinkAccLogin . ' (' . $currLinkAccId . ')</td>';
     $PHP_OUTPUT .= '<td' . ($db2->getBoolean('validated') ? '' : ' style="text-decoration:line-through;"') . '>' . $db2->getField('email') . ' (' . ($db2->getBoolean('validated') ? 'Valid' : 'Invalid') . ')</td>';
     $PHP_OUTPUT .= '<td>' . $db2->getField('common_ip') . '</td>';
     $PHP_OUTPUT .= '<td>' . date(DATE_FULL_SHORT, $db2->getField('last_login')) . ')</td><td>';
     $db2->query('SELECT * FROM account_exceptions WHERE account_id = ' . $db2->escapeNumber($currLinkAccId));
     if ($db2->nextRecord()) {
         $PHP_OUTPUT .= $db2->getField('reason');
     } else {
         $PHP_OUTPUT .= '&nbsp;';
     }
     $PHP_OUTPUT .= '</td><td>';
     if ($isDisabled) {
         $PHP_OUTPUT .= $db3->getField('suspicion');
Exemplo n.º 19
0
    $commentsContainer = $var;
    $commentsContainer['body'] = 'feature_request_comments.php';
    $db2 = new SmrMySqlDatabase();
    $featureRequests = array();
    while ($db->nextRecord()) {
        $featureRequestID = $db->getInt('feature_request_id');
        $featureRequests[$featureRequestID] = array('RequestID' => $featureRequestID, 'Message' => $db->getField('text'), 'Votes' => array('FAVOURITE' => $db->getInt('fav'), 'YES' => $db->getInt('yes'), 'NO' => $db->getInt('no')), 'VotedFor' => isset($featureVotes[$featureRequestID]) ? $featureVotes[$featureRequestID] : false);
        if ($featureModerator) {
            $featureRequests[$featureRequestID]['RequestAccount'] =& SmrAccount::getAccount($db->getInt('poster_id'));
        }
        if ($var['Status'] == 'Opened') {
            $db2->query('SELECT COUNT(*), vote_type
						FROM account_votes_for_feature
						WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID) . '
						GROUP BY vote_type');
            while ($db2->nextRecord()) {
                $featureRequests[$featureRequestID]['Votes'][$db2->getField('vote_type')] = $db2->getInt('COUNT(*)');
            }
        }
        $db2->query('SELECT COUNT(*)
					FROM feature_request_comments
					WHERE feature_request_id=' . $db2->escapeNumber($featureRequestID));
        while ($db2->nextRecord()) {
            $featureRequests[$featureRequestID]['Comments'] = $db2->getInt('COUNT(*)');
        }
        $commentsContainer['RequestID'] = $featureRequestID;
        $featureRequests[$featureRequestID]['CommentsHREF'] = SmrSession::getNewHREF($commentsContainer);
    }
    $template->assignByRef('FeatureRequests', $featureRequests);
}
$template->assign('FeatureRequestFormHREF', SmrSession::getNewHREF(create_container('feature_request_processing.php', '')));
    $container['url'] = 'skeleton.php';
    $container['body'] = 'galactic_post_view_article.php';
    transfer('id');
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= create_submit('No');
    $PHP_OUTPUT .= '</form>';
} else {
    $db->query('SELECT * FROM galactic_post_paper WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND paper_id = ' . $db->escapeNumber($var['id']));
    $db->nextRecord();
    $title = $db->getField('title');
    $PHP_OUTPUT .= 'Are you sure you want to delete the paper titled ' . $title . ' and the following articles with it<br /><br />';
    $db2->query('SELECT * FROM galactic_post_paper_content WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND paper_id = ' . $db->escapeNumber($var['id']));
    while ($db2->nextRecord()) {
        $article_id = $db2->getField('article_id');
        $db3->query('SELECT * FROM galactic_post_article WHERE game_id = ' . $db->escapeNumber($player->getGameID()) . ' AND article_id = ' . $db->escapeNumber($article_id));
        $db3->nextRecord();
        $article_title = bbifyMessage($db3->getField('title'));
        $PHP_OUTPUT .= $article_title . '<br />';
    }
    $PHP_OUTPUT .= '<br />';
    $container = array();
    $container['url'] = 'galactic_post_delete.php';
    transfer('paper');
    transfer('id');
    $PHP_OUTPUT .= create_echo_form($container);
    $PHP_OUTPUT .= create_submit('Yes');
    $PHP_OUTPUT .= '</form>';
    $container = array();
    $container['url'] = 'skeleton.php';
    $container['body'] = 'galactic_post_view_article.php';
    transfer('id');
Exemplo n.º 21
0
 }
 if (empty($total)) {
     $total = 0;
 }
 if (isset($var['variable'])) {
     $variable = $var['variable'];
 }
 //we are listing ALL IPs
 $db->query('SELECT account_id as acc_id, ip FROM account_has_ip ORDER BY ip, account_id LIMIT ' . $total . ', 1000000');
 $ip_array = array();
 $count = 0;
 //make sure we have enough but not too mant to reduce lag
 while ($db->nextRecord() && $count <= $variable) {
     $id = $db->getField('acc_id');
     $db2->query('SELECT * FROM account_is_closed WHERE account_id = ' . $db->escapeNumber($id) . ' AND reason_id = ' . $db->escapeNumber($del_num));
     if ($db2->nextRecord()) {
         continue;
     }
     $ip = $db->getField('ip');
     list($fi, $se, $th, $fo, $crap) = preg_split('/[.\\s,]/', $ip, 5);
     $ip = $fi . '.' . $se . '.' . $th . '.' . $fo;
     //$PHP_OUTPUT.=('fi='.$fi.' se='.$se.' th='.$th.' fo='.$fo.' therefore->'.$ip);
     $total += 1;
     if ($id == $last_id && $ip == $last) {
         continue;
     }
     $ip_array[] = $ip . '/' . $id;
     $last = $ip;
     $last_id = $id;
     $count++;
 }
Exemplo n.º 22
0
function album_entry($album_id)
{
    // database object
    $db = new SmrMySqlDatabase();
    // list of all first letter nicks
    create_link_list();
    if (SmrSession::$account_id != 0 && $album_id != SmrSession::$account_id) {
        $db->query('UPDATE album
				SET page_views = page_views + 1
				WHERE account_id = ' . $db->escapeNumber($album_id) . ' AND
					approved = \'YES\'');
    }
    $db->query('SELECT *
				FROM album
				WHERE account_id = ' . $db->escapeNumber($album_id) . ' AND
					approved = \'YES\'');
    if ($db->nextRecord()) {
        $location = stripslashes($db->getField('location'));
        $email = stripslashes($db->getField('email'));
        $website = stripslashes($db->getField('website'));
        $day = $db->getField('day');
        $month = $db->getField('month');
        $year = $db->getField('year');
        $other = nl2br(stripslashes($db->getField('other')));
        $page_views = $db->getField('page_views');
        $disabled = $db->getField('disabled') == 'TRUE';
    } else {
        echo '<h1>Error</h1>';
        echo 'This user doesn\'t have an entry in our album!';
        return;
    }
    // get this user's nick
    $nick = get_album_nick($album_id);
    echo '<table border="0" align="center" cellpadding="5" cellspacing="0">';
    echo '<tr>';
    echo '<td style="text-align: center;" colspan="2">';
    echo '<div style="margin-left: auto; margin-right: auto; width: 50%">';
    echo '<table style="width: 100%">';
    echo '<tr>';
    $db->query('SELECT hof_name
				FROM album JOIN account USING(account_id)
				WHERE hof_name < ' . $db->escapeString($nick) . ' AND
					approved = \'YES\'
				ORDER BY hof_name DESC
				LIMIT 1');
    echo '<td style="text-align: center; width: 30%" valign="middle">';
    if ($db->nextRecord()) {
        $priv_nick = $db->getField('hof_name');
        echo '<a href="' . URL . '/album/?' . urlencode($priv_nick) . '"><img src="' . URL . '/images/album/rew.jpg" alt="' . $priv_nick . '" border="0"></a>&nbsp;&nbsp;&nbsp;';
    }
    echo '</td>';
    echo '<td style="text-align: center;" valign="middle"><span style="font-size:150%;">' . $nick . '</span><br /><span style="font-size:75%;">Views: ' . $page_views . '</span></td>';
    $db->query('SELECT hof_name
				FROM album JOIN account USING(account_id)
				WHERE hof_name > ' . $db->escapeString($nick) . ' AND
					approved = \'YES\'
				ORDER BY hof_name
				LIMIT 1');
    echo '<td style="text-align: center; width: 30%" valign="middle">';
    if ($db->nextRecord()) {
        $next_nick = $db->getField('hof_name');
        echo '&nbsp;&nbsp;&nbsp;<a href="' . URL . '/album/?' . urlencode($next_nick) . '"><img src="' . URL . '/images/album/fwd.jpg" alt="' . $next_nick . '" border="0"></a>';
    }
    echo '</td>';
    echo '</tr>';
    echo '</table>';
    echo '</div>';
    echo '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td colspan="2" align="center" valign="middle">';
    if ($disabled == false) {
        echo '<img src="' . URL . '/upload/' . $album_id . '">';
    } else {
        echo '<img src="' . URL . '/images/album/disabled.jpg">';
    }
    echo '</td>';
    echo '</tr>';
    if (empty($location)) {
        $location = 'N/A';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">Location:</td><td>' . $location . '</td>';
    echo '</tr>';
    if (empty($email)) {
        $email = 'N/A';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">eMail:</td><td>' . $email . '</td>';
    echo '</tr>';
    if (empty($website)) {
        $website = 'N/A';
    } else {
        $website = '<a href="' . $website . '" target="_new">' . $website . '</a>';
    }
    echo '<tr>';
    echo '<td align="right" width="10%" style="font-weight:bold;">Website:</td><td>' . $website . '</td>';
    echo '</tr>';
    echo '<tr>';
    if (!empty($day) && !empty($month) && !empty($year)) {
        $birthdate = $month . ' / ' . $day . ' / ' . $year;
    }
    if (empty($birthdate) && !empty($year)) {
        $birthdate = 'Year ' . $year;
    }
    if (empty($birthdate)) {
        $birthdate = 'N/A';
    }
    echo '<td align="right" width="10%" style="font-weight:bold;">Birthdate:</td><td>' . $birthdate . '</td>';
    echo '</tr>';
    if (empty($other)) {
        $other = 'N/A';
    }
    echo '<tr>';
    echo '<td align="right" valign="top" width="10%" style="font-weight:bold;">Other&nbsp;Info:<br /><small>(AIM/ICQ)&nbsp;&nbsp;</small></td><td>' . $other . '</td>';
    echo '</tr>';
    echo '<tr>';
    echo '<td colspan="2">';
    echo '<u>Comments</u><br /><br />';
    $db->query('SELECT *
				FROM album_has_comments
				WHERE album_id = ' . $db->escapeNumber($album_id));
    while ($db->nextRecord()) {
        $time = $db->getField('time');
        $postee = get_album_nick($db->getField('post_id'));
        $msg = stripslashes($db->getField('msg'));
        echo '<span style="font-size:85%;">[' . date(defined('DATE_FULL_SHORT') ? DATE_FULL_SHORT : DEFAULT_DATE_FULL_SHORT, $time) . '] &lt;' . $postee . '&gt; ' . $msg . '</span><br />';
    }
    if (SmrSession::$account_id > 0) {
        echo '<form action="' . URL . '/album/album_comment.php">';
        echo '<input type="hidden" name="album_id" value="' . $album_id . '">';
        echo '<table>';
        echo '<tr>';
        echo '<td style="color:green; font-size:70%;">Nick:<br /><input type="text" size="10" name="nick" value="' . htmlspecialchars(get_album_nick(SmrSession::$account_id)) . '" id="InputFields" readonly></td>';
        echo '<td style="color:green; font-size:70%;">Comment:<br /><input type="text" size="50" name="comment" id="InputFields"></td>';
        echo '<td style="color:green; font-size:70%;"><br /><input type="submit" value="Send" id="InputFields"></td>';
        $db->query('SELECT *
					FROM account_has_permission
					WHERE account_id = ' . $db->escapeNumber(SmrSession::$account_id) . ' AND
						permission_id = ' . $db->escapeNumber(PERMISSION_MODERATE_PHOTO_ALBUM));
        if ($db->nextRecord()) {
            echo '<td style="color:green; font-size:70%;"><br /><input type="submit" name="action" value="Moderate" id="InputFields"></td>';
        }
        echo '</tr>';
        echo '</table>';
        echo '</form>';
    } else {
        echo '<p>Please <a href="' . URL . '/login.php?return_page=' . URL . '/album/?' . urlencode($nick) . '"><u>login</u></a> if you want comment on this picture!</p>';
    }
    echo '</td>';
    echo '</tr>';
    echo '</table>';
}
Exemplo n.º 23
0
         //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);
 }
 while ($db2->nextRecord()) {
Exemplo n.º 24
0
function &findRoutes(&$player)
{
    debug('Finding Routes');
    $galaxies =& SmrGalaxy::getGameGalaxies($player->getGameID());
    $tradeGoods = array(GOOD_NOTHING => false);
    $goods =& Globals::getGoods();
    foreach ($goods as $goodID => &$good) {
        if ($player->meetsAlignmentRestriction($good['AlignRestriction'])) {
            $tradeGoods[$goodID] = true;
        } else {
            $tradeGoods[$goodID] = false;
        }
    }
    unset($good);
    $tradeRaces = array();
    $races =& Globals::getRaces();
    foreach ($races as $raceID => &$race) {
        $tradeRaces[$raceID] = false;
    }
    unset($race);
    $tradeRaces[$player->getRaceID()] = true;
    $galaxy =& $player->getSector()->getGalaxy();
    $maxNumberOfPorts = 2;
    $routesForPort = -1;
    $numberOfRoutes = 1000;
    $maxDistance = 15;
    $startSectorID = $galaxy->getStartSector();
    $endSectorID = $galaxy->getEndSector();
    $db = new SmrMySqlDatabase();
    $db->query('SELECT routes FROM route_cache WHERE game_id=' . $db->escapeNumber($player->getGameID()) . ' AND max_ports=' . $db->escapeNumber($maxNumberOfPorts) . ' AND goods_allowed=' . $db->escapeObject($tradeGoods) . ' AND races_allowed=' . $db->escapeObject($tradeRaces) . ' AND start_sector_id=' . $db->escapeNumber($startSectorID) . ' AND end_sector_id=' . $db->escapeNumber($endSectorID) . ' AND routes_for_port=' . $db->escapeNumber($routesForPort) . ' AND max_distance=' . $db->escapeNumber($maxDistance));
    if ($db->nextRecord()) {
        $routes = unserialize(gzuncompress($db->getField('routes')));
        debug('Using Cached Routes: #' . count($routes));
        return $routes;
    } else {
        debug('Generating Routes');
        $allSectors = array();
        foreach ($galaxies as &$galaxy) {
            $allSectors += $galaxy->getSectors();
            //Merge arrays
        }
        unset($galaxy);
        $distances =& Plotter::calculatePortToPortDistances($allSectors, $maxDistance, $startSectorID, $endSectorID);
        if ($maxNumberOfPorts == 1) {
            $allRoutes = RouteGenerator::generateOneWayRoutes($allSectors, $distances, $tradeGoods, $tradeRaces, $routesForPort);
        } else {
            $allRoutes = RouteGenerator::generateMultiPortRoutes($maxNumberOfPorts, $allSectors, $tradeGoods, $tradeRaces, $distances, $routesForPort, $numberOfRoutes);
        }
        unset($distances);
        $allRoutes =& $allRoutes[RouteGenerator::EXP_ROUTE];
        $routesMerged = array();
        foreach ($allRoutes as $multi => &$routesByMulti) {
            $routesMerged += $routesByMulti;
            //Merge arrays
        }
        unset($routesByMulti);
        unset($allSectors);
        SmrPort::clearCache();
        SmrSector::clearCache();
        $db->query('INSERT INTO route_cache ' . '(game_id, max_ports, goods_allowed, races_allowed, start_sector_id, end_sector_id, routes_for_port, max_distance, routes)' . ' VALUES (' . $db->escapeNumber($player->getGameID()) . ', ' . $db->escapeNumber($maxNumberOfPorts) . ', ' . $db->escapeObject($tradeGoods) . ', ' . $db->escapeObject($tradeRaces) . ', ' . $db->escapeNumber($startSectorID) . ', ' . $db->escapeNumber($endSectorID) . ', ' . $db->escapeNumber($routesForPort) . ', ' . $db->escapeNumber($maxDistance) . ', ' . $db->escapeObject($routesMerged, true) . ')');
        debug('Found Routes: #' . count($routesMerged));
        return $routesMerged;
    }
}
Exemplo n.º 25
0
        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_OUTPUT .= $form['submit'];
    $PHP_OUTPUT .= '</form><br />';
} else {
    $PHP_OUTPUT .= 'You are currently accepting all communications.<br />';
}
$PHP_OUTPUT .= '<br /><h2>Blacklist Player</h2><br />';
$container = array();
Exemplo n.º 26
0
function private_msg_weapon($fp, $rdata)
{
    global $channel;
    $type = 0;
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!weapon\\sname\\s(.*)\\s$/i', $rdata, $msg_1)) {
        $name = $msg_1[1];
        sleep(2);
        $type = 1;
    } elseif (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!weapon\\slevel\\s(.*)\\s(.*)\\s$/i', $rdata, $msg_2)) {
        $name = $msg_2[1];
        sleep(2);
        $type = 2;
    } elseif (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s' . $channel . '\\s:!weapon\\srange\\s(.*)\\s(.*)\\s(.*)\\s(.*)\\s$/i', $rdata, $msg_3)) {
        $name = $msg_3[1];
        sleep(2);
        $type = 3;
    }
    //first lets get our orders so we can make sure our query will work
    $a = array();
    $a[] = 'cost';
    $a[] = 'weapon_name';
    $a[] = 'shield_damage';
    $a[] = 'armour_damage';
    $a[] = 'accuracy';
    $a[] = 'race_id';
    $a[] = 'buyer_restriction';
    $a[] = 'power_level';
    $db = new SmrMySqlDatabase();
    if ($type == 1) {
        $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE weapon_name LIKE ' . $db->escape_string('%' . $msg_1[4] . '%'));
    } elseif ($type == 2) {
        if (in_array($msg_2[5], $a)) {
            $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE power_level = ' . $msg_2[4] . ' ORDER BY ' . $msg_2[5] . ' DESC');
        } else {
            $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE power_level = ' . $msg_2[4]);
        }
    } elseif ($type == 3) {
        //[4] = object
        //[5] = lower limit
        //[6] = upper limit
        //[7] = order
        //first make sure we arent flooding
        sleep(2);
        if (in_array($msg_3[4], $a) && in_array($msg_3[7], $a)) {
            $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE ' . $msg_3[4] . ' > ' . $msg_3[5] . ' AND ' . $msg_3[4] . ' < ' . $msg_3[6] . ' ORDER BY ' . $msg_3[7] . ' DESC');
        } elseif (in_array($msg_3[4], $a)) {
            $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE ' . $msg_3[4] . ' > ' . $msg_3[5] . ' AND ' . $msg_3[4] . ' < ' . $msg_3[6]);
        } else {
            $rand = mt_rand(0, 7);
            $object = $a[$rand];
            $db->query('SELECT * FROM weapon_type JOIN race USING(race_id) WHERE ' . $object . ' > ' . $msg_3[5] . ' AND ' . $object . ' < ' . $msg_3[6]);
        }
    }
    if ($db->getNumRows()) {
        fputs($fp, 'PRIVMSG ' . $name . ' :Name | Cost | Shield Damage | Armour Damage | Accuracy | Race | Restriction' . EOL);
        sleep(2);
        while ($db->nextRecord()) {
            $weapon_name = $db->getField('weapon_name');
            $hardpoint = $db->getField('power_level');
            $shield = $db->getField('shield_damage');
            $armour = $db->getField('armour_damage');
            $acc = $db->getField('accuracy');
            $race = $db->getField('race_name');
            $restrict = $db->getField('buyer_restriction');
            $cost = $db->getField('cost');
            $private_message = 'PRIVMSG ' . $name . ' :' . $weapon_name . ' | ' . $cost . ' | ' . $shield . ' | ' . $armour . ' | ' . $acc . ' | ' . $race . ' | ';
            if ($restrict == 1) {
                $private_message .= 'Good';
            } elseif ($restrict == 2) {
                $private_message .= 'Evil';
            } else {
                $private_message .= 'None';
            }
            $private_message .= EOL;
            fputs($fp, $private_message);
            sleep(2);
        }
    } elseif ($type == 1) {
        fputs($fp, 'PRIVMSG ' . $name . ' :There is no weapon called ' . $msg_1[5] . '!' . EOL);
    } elseif ($type == 2) {
        fputs($fp, 'PRIVMSG ' . $name . ' :There is no weapon with ' . $msg_2[4] . ' power level!' . EOL);
    } elseif ($type == 3) {
        fputs($fp, 'PRIVMSG ' . $name . ' :There is no weapon in the cost range of ' . $msg_3[4] . ' - ' . $msg_3[5] . '!' . EOL);
    }
    if (isset($type)) {
        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()');
        $PHP_OUTPUT .= '</td>';
Exemplo n.º 28
0
					AND alliance_id =' . $db2->escapeNumber($alliance->getAllianceID()) . '
					AND thread_id=' . $db2->escapeNumber($threadID) . '
					AND time>' . $db2->escapeNumber($db->getInt('sendtime')) . ' LIMIT 1');
        $threads[$i]['Unread'] = $db2->getNumRows() == 0;
        if ($db->getInt('sender_id') > 0) {
            $db2->query('SELECT
						player.player_name as player_name,
						alliance_thread.sender_id as sender_id
						FROM player
						JOIN alliance_thread ON alliance_thread.game_id = player.game_id AND player.account_id=alliance_thread.sender_id
						WHERE player.game_id=' . $db2->escapeNumber($player->getGameID()) . '
						AND alliance_thread.alliance_id=' . $db2->escapeNumber($alliance->getAllianceID()) . '
						AND alliance_thread.thread_id=' . $db2->escapeNumber($threadID) . '
						AND alliance_thread.reply_id=1 LIMIT 1
						');
            if ($db2->nextRecord()) {
                $sender_id = $db2->getInt('sender_id');
                $author =& SmrPlayer::getPlayer($sender_id, $player->getGameID());
                $playerName = $author->getLinkedDisplayName(false);
            } else {
                $playerName = 'Unknown';
            }
        } else {
            $sender_id = $db->getInt('sender_id');
            if ($sender_id == 0) {
                $playerName = 'Planet Reporter';
            }
            if ($sender_id == -1) {
                $playerName = 'Bank Reporter';
            }
            if ($sender_id == -2) {
Exemplo n.º 29
0
function channel_msg_forces($fp, $rdata, $account, $player)
{
    if (preg_match('/^:(.*)!(.*)@(.*)\\sPRIVMSG\\s(.*)\\s:!forces(.*)\\s$/i', $rdata, $msg)) {
        $nick = $msg[1];
        $user = $msg[2];
        $host = $msg[3];
        $channel = $msg[4];
        $galaxy = trim($msg[5]);
        echo_r('[FORCE_EXPIRE] by ' . $nick . ' in ' . $channel . ' Galaxy: ' . $galaxy);
        // did we get a galaxy name?
        $db = new SmrMySqlDatabase();
        if (!empty($galaxy)) {
            $db->query('SELECT sector_has_forces.sector_id AS sector, combat_drones, scout_drones, mines, expire_time
						FROM sector_has_forces
						LEFT JOIN sector USING (sector_id, game_id)
						LEFT JOIN game_galaxy USING (game_id, galaxy_id)
						WHERE sector_has_forces.game_id = ' . $player->getGameID() . '
							AND galaxy_name = ' . $db->escapeString($galaxy) . '
							AND owner_id IN (
								SELECT account_id
								FROM player
								WHERE game_id = ' . $player->getGameID() . '
									AND alliance_id = ' . $player->getAllianceID() . '
							)
						ORDER BY expire_time ASC');
        } else {
            $db->query('SELECT sector_has_forces.sector_id AS sector, combat_drones, scout_drones, mines, expire_time
				FROM sector_has_forces
				WHERE game_id = ' . $player->getGameID() . '
					AND owner_id IN (
						SELECT account_id
						FROM player
						WHERE game_id = ' . $player->getGameID() . '
						AND alliance_id = ' . $player->getAllianceID() . '
					)
				ORDER BY expire_time ASC');
        }
        if ($db->nextRecord()) {
            $sector_id = $db->getField('sector');
            $expire = $db->getField('expire_time');
            fputs($fp, 'PRIVMSG ' . $channel . ' :Forces in sector ' . $sector_id . ' will expire in ' . format_time($expire - time()) . EOL);
        } else {
            fputs($fp, 'PRIVMSG ' . $channel . ' :' . $nick . ', your alliance does not own any forces that could expire.' . EOL);
        }
        return true;
    }
    return false;
}
Exemplo n.º 30
0
$db->query('SELECT * FROM race_has_voting
			WHERE ' . $db->escapeNumber(TIME) . ' < end_time
			AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
			AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()));
if ($db->getNumRows() > 0) {
    $db2 = new SmrMySqlDatabase();
    while ($db->nextRecord()) {
        $otherRaceID = $db->getField('race_id_2');
        $container = create_container('council_vote_processing.php', '', array('race_id' => $otherRaceID));
        // get 'yes' votes
        $db2->query('SELECT count(*) FROM player_votes_pact
					WHERE game_id = ' . $db2->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db2->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db2->escapeNumber($otherRaceID) . '
						AND vote = \'YES\'');
        $db2->nextRecord();
        $yesVotes = $db2->getInt('count(*)');
        // get 'no' votes
        $db2->query('SELECT count(*) FROM player_votes_pact
					WHERE game_id = ' . $db2->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db2->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db2->escapeNumber($otherRaceID) . '
						AND vote = \'NO\'');
        $db2->nextRecord();
        $noVotes = $db2->getInt('count(*)');
        $db2->query('SELECT vote FROM player_votes_pact
					WHERE account_id = ' . $db->escapeNumber($player->getAccountID()) . '
						AND game_id = ' . $db->escapeNumber($player->getGameID()) . '
						AND race_id_1 = ' . $db->escapeNumber($player->getRaceID()) . '
						AND race_id_2 = ' . $db->escapeNumber($otherRaceID));
        $votedFor = '';