Beispiel #1
0
if (isset($_REQUEST['type'])) {
    SmrSession::updateVar('Type', $_REQUEST['type']);
}
$type = $var['Type'];
$db2 = new SmrMySqlDatabase();
//used to make sure we don't display deleted accounts
$del_num = 5;
$close_reason = ' ';
if (isset($var['type'])) {
    $type = $var['type'];
}
//another script for comp share
if ($type == 'comp_share') {
    include get_file_loc('comp_share.php');
} elseif ($type == 'all_acc') {
    include get_file_loc('list_all.php');
} elseif ($type == 'list') {
    if (isset($var['total'])) {
        $total = $var['total'];
    }
    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
Beispiel #2
0
 if (SmrSession::$account_id > 0) {
     $account =& SmrAccount::getAccount(SmrSession::$account_id);
     $disabled = $account->isDisabled();
     if ($disabled !== false) {
         $reason = $disabled['Reason'];
         if ($disabled['Time'] > 0) {
             $reason .= '  Your account is set to reopen on ' . date(DEFAULT_DATE_FULL_LONG, $disabled['Time']) . '.';
         } else {
             $reason .= '  Your account is set to never reopen.  If you believe this is wrong contact an admin.';
         }
     }
     //	SmrSession::destroy();
 } else {
     if (USE_COMPATIBILITY && SmrSession::$old_account_id > 0) {
         foreach (Globals::getCompatibilityDatabases('Game') as $databaseClassName => $gameType) {
             require_once get_file_loc($databaseClassName . '.class.inc');
             $db = new $databaseClassName();
             $db->query('SELECT * FROM account_is_closed JOIN closing_reason USING(reason_id) WHERE account_id = ' . $db->escapeNumber(SmrSession::$old_account_id));
             if ($db->nextRecord()) {
                 $time = $db->getField('expires');
                 $reason = $db->getField('reason');
                 if ($time > 0) {
                     $reason .= '  Your account is set to reopen ' . date(DEFAULT_DATE_FULL_LONG, $time) . '.';
                 } else {
                     $reason .= '  Your account is set to never reopen.  If you believe this is wrong contact an admin.';
                 }
             }
         }
         //	SmrSession::destroy();
     } else {
         $reason = 'Accessing Account Information Failed.  Contact an admin if you have questions.';
Beispiel #3
0
<?php

require_once get_file_loc("smr_planet.inc");
if ($player->land_on_planet == "FALSE") {
    print_error("You are not on a planet!");
    return;
}
// create planet object
$planet = new SMR_PLANET($player->sector_id, $player->game_id);
$planet->build();
print_topic("PLANET : {$planet->planet_name} [SECTOR #{$player->sector_id}]");
include get_file_loc('menue.inc');
print_planet_menue();
//print the dump cargo message or other message.
if (isset($var["msg"])) {
    print $var["msg"] . "<br>";
}
print "<table cellspacing=\"0\" cellpadding=\"3\" border=\"0\" class=\"standard\">";
print "<tr>";
print "<th width=\"125\">&nbsp;</th>";
print "<th width=\"75\">Current</th>";
print "<th width=\"75\">Max</th>";
print "</tr>";
print "<tr>";
print "<td>Generator</td><td align=\"center\">";
print $planet->construction[1];
print "</td><td align=\"center\">";
print $planet->max_construction[1];
print "</td>";
print "</tr>";
print "<tr>";
<?php

require_once '/home/page/SMR/htdocs/config.inc';
require_once ENGINE . 'Default/smr.inc';
require_once get_file_loc('SmrSector.class.inc');
require_once get_file_loc('SmrGalaxy.class.inc');
require_once get_file_loc('Plotter.class.inc');
testDistances(1);
function testDistances($gameID)
{
    //Initialise cache for fairness
    $galaxies =& SmrGalaxy::getGameGalaxies($gameID);
    $galaxySectors = array();
    foreach ($galaxies as &$galaxy) {
        $galaxiesSectors[] =& $galaxy->getSectors();
    }
    unset($galaxy);
    foreach ($galaxiesSectors as &$galaxySectors) {
        foreach ($galaxySectors as &$galaxySector) {
            if ($galaxySector->hasPort()) {
                $galaxySector->getPort()->getGoods();
            }
        }
        unset($galaxySector);
    }
    unset($galaxySectors);
    //Test plotters
    $newTime = 0;
    $oldTime = 0;
    foreach ($galaxiesSectors as &$galaxySectors) {
        foreach ($galaxySectors as &$galaxySector) {
Beispiel #5
0
<?php

require_once get_file_loc("smr_history_db.inc");
print "<div align=center>";
//topic
if (isset($var["game_name"])) {
    $game_name = $var["game_name"];
}
if (isset($var["game_id"])) {
    $game_id = $var["game_id"];
}
if (isset($game_name)) {
    $topic = "Game {$var['game_name']}";
} else {
    $topic = "Games";
}
print_topic("Viewing Old SMR {$topic}");
if (!isset($game_name)) {
    //list old games
    $db2 = new SMR_HISTORY_DB();
    $db2->query("SELECT DATE_FORMAT(start_date, '%c/%e/%Y') as start_date, " . "DATE_FORMAT(end_date, '%c/%e/%Y') as end_date, game_name, speed, game_id " . "FROM game ORDER BY game_id");
    if ($db2->nf()) {
        print_table();
        print "<tr><th align=center>Game Name</th><th align=center>Start Date</th><th align=center>End Date</th><th align=center>Speed</th><th align=center colspan=3>Options</th></tr>";
        while ($db2->next_record()) {
            $id = $db2->f("game_id");
            $container = array();
            $container["url"] = "skeleton.php";
            $container["game_id"] = $db2->f("game_id");
            $container["game_name"] = $db2->f("game_name");
            $container["body"] = "games_previous.php";
Beispiel #6
0
function displayMessage(&$messageBox, $message_id, $receiver_id, $sender_id, $message_text, $send_time, $msg_read, $type, $sentMessage = false)
{
    require_once get_file_loc('message.functions.inc');
    global $player, $account;
    $message = array();
    $sender = false;
    $senderName =& getMessagePlayer($sender_id, $player->getGameID(), $type);
    if ($senderName instanceof SmrPlayer) {
        $sender =& $senderName;
        unset($senderName);
        $replace = explode('?', $message_text);
        foreach ($replace as $key => $timea) {
            if ($sender_id > 0 && $timea != '' && ($final = strtotime($timea)) !== false) {
                //WARNING: Expects PHP 5.1.0 or later
                $send_acc =& $sender->getAccount();
                $final += $account->getOffset() * 3600 - $send_acc->getOffset() * 3600;
                $message_text = str_replace('?' . $timea . '?', date(DATE_FULL_SHORT, $final), $message_text);
            }
        }
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $sender->getPlayerID();
        $senderName =& create_link($container, $sender->getDisplayName());
    }
    $container = create_container('skeleton.php', 'message_notify_confirm.php');
    $container['message_id'] = $message_id;
    $container['sent_time'] = $send_time;
    $message['ReportHref'] = SmrSession::getNewHREF($container);
    if (is_object($sender)) {
        $container = create_container('skeleton.php', 'message_blacklist_add.php');
        $container['account_id'] = $sender_id;
        $message['BlacklistHref'] = SmrSession::getNewHREF($container);
        $container = create_container('skeleton.php', 'message_send.php');
        $container['receiver'] = $sender->getAccountID();
        $message['ReplyHref'] = SmrSession::getNewHREF($container);
        $message['Sender'] =& $sender;
    }
    $message['ID'] = $message_id;
    $message['Text'] = $message_text;
    $message['SenderDisplayName'] = $senderName;
    $receiver =& SmrPlayer::getPlayer($receiver_id, $player->getGameID());
    if ($sentMessage && is_object($receiver)) {
        $container = create_container('skeleton.php', 'trader_search_result.php');
        $container['player_id'] = $receiver->getPlayerID();
        $message['ReceiverDisplayName'] = create_link($container, $receiver->getDisplayName());
    }
    $message['Unread'] = $msg_read == 'FALSE';
    $message['SendTime'] = $send_time;
    $messageBox['Messages'][] =& $message;
}
Beispiel #7
0
            // save to db (not the inital value)
            if ($current_sector_id != $low - 1) {
                $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)) . "')");
            }
            // reset variables
            $current_sector_id = $sector_id;
            $port_info = array();
        }
        // add to port info array
        $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");
Beispiel #8
0
<?php

if (!isset($var['GameID'])) {
    SmrSession::updateVar('GameID', $player->getGameID());
}
$gameID = $var['GameID'];
$template->assign('PageTopic', 'Current News');
require_once get_file_loc('menu.inc');
create_news_menu($template);
require_once get_file_loc('news.functions.inc');
doBreakingNewsAssign($gameID, $template);
doLottoNewsAssign($gameID, $template);
if (!isset($var['LastNewsUpdate'])) {
    SmrSession::updateVar('LastNewsUpdate', $player->getLastNewsUpdate());
}
$db->query('SELECT * FROM news WHERE game_id = ' . $db->escapeNumber($gameID) . ' AND time > ' . $db->escapeNumber($var['LastNewsUpdate']) . ' AND type = \'regular\' ORDER BY news_id DESC');
$player->updateLastNewsUpdate();
if ($db->getNumRows()) {
    $NewsItems = array();
    while ($db->nextRecord()) {
        $NewsItems[] = array('Time' => $db->getField('time'), 'Message' => bbifyMessage($db->getField('news_message')), 'Type' => $db->getField('type'));
    }
    $template->assign('NewsItems', $NewsItems);
}
}
if (isset($take_scout_drones) && !is_numeric($take_scout_drones)) {
    create_error("Only numbers as input allowed");
}
// round if necessary
$drop_mines = round($drop_mines);
$drop_combat_drones = round($drop_combat_drones);
$drop_scout_drones = round($drop_scout_drones);
$take_mines = round($take_mines);
$take_combat_drones = round($take_combat_drones);
$take_scout_drones = round($take_scout_drones);
// so how many forces do we take/add per type?
$change_mines = $drop_mines - $take_mines;
$change_combat_drones = $drop_combat_drones - $take_combat_drones;
$change_scout_drones = $drop_scout_drones - $take_scout_drones;
include get_file_loc('mine_change.php');
// check max on that stack
if ($forces->mines + $change_mines > 50) {
    create_error("This stack can only take up to 50 mines!");
}
if ($forces->combat_drones + $change_combat_drones > 50) {
    create_error("This stack can only take up to 50 combat drones!");
}
if ($forces->scout_drones + $change_scout_drones > 5) {
    create_error("This stack can only take up to 5 scout drones!");
}
// do we have any action at all?
if ($change_mines == 0 && $change_combat_drones == 0 && $change_scout_drones == 0) {
    create_error("You want to add/remove 0 forces?");
}
// combat drones
Beispiel #10
0
    }
    //used for include if we need a spec game script outside of the game
    $overrideGameID = 0;
    if (isset($var['game_id']) && is_numeric($var['game_id'])) {
        $overrideGameID = $var['game_id'];
    }
    if ($overrideGameID == 0 && isset($var['GameID']) && is_numeric($var['GameID'])) {
        $overrideGameID = $var['GameID'];
    }
    if ($overrideGameID == 0) {
        $overrideGameID = SmrSession::$game_id;
    }
    require_once get_file_loc('SmrAccount.class.inc');
    $account =& SmrAccount::getAccount(SmrSession::$account_id);
    // get reason for disabled user
    if (($disabled = $account->isDisabled()) !== false) {
        // save session (incase we forward)
        SmrSession::update();
        if ($disabled['Reason'] == 'Invalid eMail') {
            header('Location: ' . URL . '/email.php');
            exit;
        } else {
            header('Location: ' . URL . '/disabled.php');
            exit;
        }
    }
    require_once get_file_loc('smr.inc');
    do_voodoo();
} catch (Exception $e) {
    handleException($e);
}
Beispiel #11
0
<?php

try {
    // includes
    require_once 'config.inc';
    require_once ENGINE . 'Default/smr.inc';
    require_once get_file_loc('SmrAccount.class.inc');
    require_once get_file_loc('SmrSession.class.inc');
    // do we have a session?
    if (SmrSession::$account_id == 0) {
        header('Location: ' . URL . '/login.php');
        exit;
    }
    // get account
    $account =& SmrAccount::getAccount(SmrSession::$account_id);
    ?>
<!DOCTYPE html>

<html>
	<head>
		<link rel="stylesheet" type="text/css" href="<?php 
    echo DEFAULT_CSS;
    ?>
">
		<link rel="stylesheet" type="text/css" href="<?php 
    echo DEFAULT_CSS_COLOUR;
    ?>
">
		<title>Space Merchant Realms</title>
		<meta http-equiv='pragma' content='no-cache'>
	</head>
    $db->query("SELECT * FROM macro_check WHERE account_id = {$player->account_id}");
    if ($db->next_record()) {
        $db->query("UPDATE macro_check SET good = good + 1 WHERE account_id = {$player->account_id}");
    } else {
        $db->query("REPLACE INTO macro_check (account_id, good) VALUES ({$player->account_id}, 1)");
    }
} elseif (!$var["legit"]) {
    $db->query("SELECT * FROM macro_check WHERE account_id = {$player->account_id}");
    if ($db->next_record()) {
        $db->query("UPDATE macro_check SET bad = bad + 1 WHERE account_id = {$player->account_id}");
    } else {
        $db->query("REPLACE INTO macro_check (account_id, bad) VALUES ({$player->account_id}, 1)");
    }
}
//this might help
include get_file_loc("trader_attack.inc");
$db2 = new SmrMySqlDatabase();
// initialize random generator.
mt_srand((double) microtime() * 1000000);
// creates a new player object for attacker and defender
$attacker_id = SmrSession::$old_account_id;
$defender_id = $var["target"];
$attacker_team = new SMR_BATTLE($attacker_id, SmrSession::$game_id);
$defender_team = new SMR_BATTLE($defender_id, SmrSession::$game_id);
$sector_id = $player->sector_id;
// is the defender on the planet?
// or did he left the sector?
// or is he dead?
$db->query("SELECT * FROM player " . "WHERE account_id = {$defender_id} AND " . "dead = 'TRUE' AND " . "game_id = " . SmrSession::$game_id);
if ($db->nf() == 1) {
    create_error("Your target is already dead!");
Beispiel #13
0
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
require_once get_file_loc("smr_force.inc");
print_topic("SECTOR SCAN");
// initialize vars
$friendly_forces = 0;
$enemy_forces = 0;
$friendly_vessel = 0;
$enemy_vessel = 0;
// get our rank
$rank_id = $account->get_rank();
// iterate over all forces in the target sector
$db->query("SELECT * FROM sector_has_forces WHERE game_id = {$player->game_id} AND " . "sector_id = " . $var["target_sector"]);
while ($db->next_record()) {
    // we may skip forces if this is a protected gal.
    if ($sector->is_protected_gal()) {
        $forces_account = new SMR_ACCOUNT();
        $forces_account->get_by_id($db->f("owner_id"));
        // if one is vet and the other is newbie we skip it
        if (different_level($rank_id, $forces_account->get_rank(), $account->veteran, $forces_account->veteran)) {
            continue;
        }
    }
    // decide if it's an friendly or enemy stack
    $forces_owner = new SMR_PLAYER($db->f("owner_id"), $player->game_id);
    $forces = new SMR_FORCE($db->f("owner_id"), $var["target_sector"], $player->game_id);
    if ($player->alliance_id == 0 && $forces->owner_id == $player->account_id || $player->alliance_id != 0 && $player->alliance_id == $forces_owner->alliance_id) {
        $friendly_forces += $forces->mines * 3 + $forces->combat_drones * 2 + $forces->scout_drones;
    } else {
<?php

require_once get_file_loc('SmrAlliance.class.inc');
// ********************************
// *
// * V a l i d a t e d ?
// *
// ********************************
// is account validated?
if (!$account->isValidated()) {
    create_error('You are not validated. You can\'t join an alliance yet.');
}
// ********************************
// *
// * B e g i n
// *
// ********************************
$alliance =& SmrAlliance::getAlliance($var['alliance_id'], $player->getGameID());
if ($alliance->canJoinAlliance($player) !== true) {
    create_error('You are not able to join this alliance currently.');
}
if ($_REQUEST['password'] != $alliance->getPassword()) {
    create_error('Incorrect Password!');
}
// assign the player to the current alliance
$player->joinAlliance($alliance->getAllianceID());
$player->update();
forward(create_container('skeleton.php', 'alliance_roster.php'));
Beispiel #15
0
try {
    // ********************************
    // *
    // * I n c l u d e s   h e r e
    // *
    // ********************************
    require_once 'config.inc';
    require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
    require_once LIB . 'Default/Globals.class.inc';
    require_once get_file_loc('smr.inc');
    require_once get_file_loc('SmrAccount.class.inc');
    require_once get_file_loc('SmrPlayer.class.inc');
    require_once get_file_loc('SmrSector.class.inc');
    require_once get_file_loc('SmrSession.class.inc');
    require_once get_file_loc('SmrGalaxy.class.inc');
    // avoid site caching
    header('Expires: Mon, 03 Nov 1976 16:10:00 GMT');
    header('Last-Modified: ' . gmdate('D, d M Y H:i:s') . ' GMT');
    header('Cache-Control: no-cache');
    header('Pragma: no-cache');
    header('Cache-Control: post-check=0, pre-check=0', FALSE);
    // ********************************
    // *
    // * S e s s i o n
    // *
    // ********************************
    // do we have a session?
    if (SmrSession::$account_id == 0 || SmrSession::$game_id == 0) {
        header('Location: ' . URL . '/login.php');
        exit;
$drop_scout_drones = round(isset($var['drop_scout_drones']) ? $var['drop_scout_drones'] : (isset($_REQUEST['drop_scout_drones']) ? trim($_REQUEST['drop_scout_drones']) : 0));
$take_mines = round(isset($var['take_mines']) ? $var['take_mines'] : (isset($_REQUEST['take_mines']) ? trim($_REQUEST['take_mines']) : 0));
$take_combat_drones = round(isset($var['take_combat_drones']) ? $var['take_combat_drones'] : (isset($_REQUEST['take_combat_drones']) ? trim($_REQUEST['take_combat_drones']) : 0));
$take_scout_drones = round(isset($var['take_scout_drones']) ? $var['take_scout_drones'] : (isset($_REQUEST['take_scout_drones']) ? trim($_REQUEST['take_scout_drones']) : 0));
// do we have numbers?
if (!empty($drop_mines) && !is_numeric($drop_mines) || !empty($drop_combat_drones) && !is_numeric($drop_combat_drones) || !empty($drop_scout_drones) && !is_numeric($drop_scout_drones) || !empty($take_mines) && !is_numeric($take_mines) || !empty($take_combat_drones) && !is_numeric($take_combat_drones) || !empty($take_scout_drones) && !is_numeric($take_scout_drones)) {
    create_error('Only numbers as input allowed!');
}
// so how many forces do we take/add per type?
$change_mines = $drop_mines - $take_mines;
$change_combat_drones = $drop_combat_drones - $take_combat_drones;
$change_scout_drones = $drop_scout_drones - $take_scout_drones;
if ($sector->hasLocation()) {
    create_error('You can\'t drop forces in a sector with a location!');
}
require_once get_file_loc('SmrForce.class.inc');
$forces =& SmrForce::getForce($player->getGameID(), $player->getSectorID(), $var['owner_id']);
// check max on that stack
if ($forces->getMines() + $change_mines > 50) {
    $change_mines = 50 - $forces->getMines();
    //	create_error('This stack can only take up to 50 mines!');
}
if ($forces->getCDs() + $change_combat_drones > 50) {
    $change_combat_drones = 50 - $forces->getCDs();
    //	create_error('This stack can only take up to 50 combat drones!');
}
if ($forces->getSDs() + $change_scout_drones > 5) {
    $change_scout_drones = 5 - $forces->getSDs();
    //	create_error('This stack can only take up to 5 scout drones!');
}
// Check if the delta is 0 after applying the caps, in case by applying the caps we actually changed it to 0.
Beispiel #17
0
<?php

try {
    // ********************************
    // *
    // * I n c l u d e s   h e r e
    // *
    // ********************************
    require_once 'config.inc';
    require_once LIB . 'Default/SmrMySqlDatabase.class.inc';
    require_once ENGINE . 'Default/smr.inc';
    require_once get_file_loc('SmrSession.class.inc');
    require_once get_file_loc('SmrAccount.class.inc');
    // ********************************
    // *
    // * S e s s i o n
    // *
    // ********************************
    if (SmrSession::$account_id > 0) {
        // creates a new user account object
        $account =& SmrAccount::getAccount(SmrSession::$account_id);
        // update last login column
        $account->updateLastLogin();
        $href = SmrSession::getNewHREF(create_container('login_check_processing.php'), true);
        SmrSession::update();
        header('Location: ' . $href);
        exit;
    }
    if (isset($_REQUEST['msg'])) {
        $template->assign('Message', htmlentities(trim($_REQUEST['msg']), ENT_COMPAT, 'utf-8'));
    }
<?php

if (isset($var['alliance_id'])) {
    $alliance_id = $var['alliance_id'];
} else {
    $alliance_id = $player->alliance_id;
}
require_once get_file_loc('smr_alliance.inc');
if (isset($_REQUEST['password'])) {
    $password = $_REQUEST['password'];
}
if (isset($_REQUEST['description'])) {
    $description = $_REQUEST['description'];
}
if (isset($_REQUEST['mod'])) {
    $mod = $_REQUEST['mod'];
}
if (isset($_REQUEST['url'])) {
    $url = $_REQUEST['url'];
}
if (isset($password) && $password == "") {
    create_error("I advice you set a non empty password!");
}
if (isset($description) && $description == "") {
    create_error("Please enter a description for your alliance");
}
$alliance = new SMR_ALLIANCE($alliance_id, $player->game_id);
if (isset($password)) {
    $alliance->password = $password;
}
if (isset($description)) {
Beispiel #19
0
<?php

require_once get_file_loc('ChessGame.class.inc');
$template->assignByRef('ChessGame', ChessGame::getChessGame($var['ChessGameID']));
$template->assign('ChessMoveHREF', SmrSession::getNewHREF(create_container('chess_move_processing.php', '', array('AJAX' => true, 'ChessGameID' => $var['ChessGameID']))));
Beispiel #20
0
if (SmrSession::$game_id > 0) {
    echo '<big>';
    $container['body'] = 'chat_rules.php';
    print_link($container, 'IRC Chat');
    echo '</big><br>';
}
echo '<a href="http://smrcnn.smrealms.de/viewtopic.php?t=3515/album/" target="_blank">User Policy</a><br>';
echo '<a href="http://smrcnn.smrealms.de/" target="_blank">WebBoard</a></b><br>';
$container['body'] = 'donation.php';
print_link($container, 'Donate');
echo '
</div></div>
</td>
<td colspan="2" class="m0"><div class="m1"><div class="m2">
';
include get_file_loc($var["body"]);
echo '
</div></div>
</td>
<td rowspan="2" class="r0"><div class="r1"><div class="r2">
';
if (SmrSession::$game_id != 0) {
    $under_attack_shields = $ship->old_hardware[HARDWARE_SHIELDS] != $ship->hardware[HARDWARE_SHIELDS];
    $under_attack_armor = $ship->old_hardware[HARDWARE_ARMOR] != $ship->hardware[HARDWARE_ARMOR];
    $under_attack_drones = $ship->old_hardware[HARDWARE_COMBAT] != $ship->hardware[HARDWARE_COMBAT];
    if ($under_attack_shields || $under_attack_armor || $under_attack_drones) {
        echo '
			<div id="attack_warning" class="attack_warning"><nobr>You are under attack!</nobr></div>
			<script type="text/javascript">
			SetBlink();
			</script>
            // do we want transfer more than we have?
            if ($amount > $planet->drones) {
                create_error("You can't take more drones from planet than are on it!");
            }
            // do we want to transfer more than we can carry?
            if ($amount > $ship->max_hardware[4] - $ship->hardware[4]) {
                create_error("You can't take more drones than you can carry!");
            }
            // now transfer
            $planet->drones -= $amount;
            $ship->hardware[4] += $amount;
            $account->log(11, "Player takes {$amount} drones from planet.", $player->sector_id);
        }
    }
} elseif ($action == "Planet") {
    include get_file_loc('planet_defenses_disallow.php');
    // do the user wants to transfer shields?
    if ($type_id == 1) {
        // do we want transfer more than we have?
        if ($amount > $ship->hardware[1]) {
            create_error("You can't transfer more shields than you carry!");
        }
        // do we want to transfer more than the planet can hold?
        if ($amount + $planet->shields > $planet->construction[1] * 100) {
            create_error("The planet can't hold more than " . $planet->construction[1] * 100 . " shields!");
        }
        // now transfer
        $planet->shields += $amount;
        $ship->hardware[1] -= $amount;
        $account->log(11, "Player puts {$amount} shields on planet.", $player->sector_id);
        // do the user wants to transfer drones?
Beispiel #22
0
require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
//first check if there is a bar here
if (!$sector->has_bar()) {
    create_error("So two guys walk into this bar...");
}
//get script to include
if (isset($var["script"])) {
    $script = $var["script"];
} else {
    $script = "bar_opening.php";
}
//if ($script == 'bar_gambling_bet.php') create_error("Blackjack is currently outlawed, you will have to come back later.");
//get bar name
$db->query("SELECT location_name FROM location_type NATURAL JOIN location WHERE game_id = {$player->game_id} AND sector_id = {$player->sector_id} AND location_type.location_type_id > 800 AND location_type.location_type_id < 900");
//next welcome them
if ($db->next_record()) {
    print_topic("Welcome to " . $db->f("location_name") . ".");
} else {
    print_topic("Welcome to this bar");
}
//include menu (not menue ;) )
include get_file_loc('menue.inc');
print_bar_menue();
//get rid of drinks older than 30 mins
$time = time() - 1800;
$db->query("DELETE FROM player_has_drinks WHERE time < {$time}");
//include bar part
include get_file_loc("{$script}");
Beispiel #23
0
<?php

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

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
require_once get_file_loc("smr_port.inc");
require_once get_file_loc("smr_battle.inc");
$port = new SMR_PORT($player->sector_id, $player->game_id);
if ($player->newbie_turns > 0) {
    create_error("You are under newbie protection!");
}
if ($player->is_fed_protected()) {
    create_error("You are under federal protection! That wouldn't be fair.");
}
if (!$sector->has_port()) {
    create_error("There is no port in that sector!");
}
// check if he got enough turns
if ($player->get_info('turns') < 3) {
    create_error("You do not have enough turns to attack this port!");
}
$db->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$player->account_id} AND " . "game_id = {$player->game_id} " . "ORDER BY order_id");
if (!$db->next_record()) {
    //do we have drones to attack?
    $db->query("SELECT * FROM ship_has_hardware WHERE hardware_type_id = HARDWARE_COMBAT AND account_id = {$player->account_id} AND game_id = {$player->game_id}");
    if (!$db->next_record()) {
        create_error("What are you gonna do? Insult it to death?");
    }
}
//set the attack start time
$time = time();
//only 1 shot per 2 seconds (stop double port raids)
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
require_once get_file_loc("smr_planet.inc");
print_topic("VIEWING PLANET DETAILS");
$db2 = new SmrMySqlDatabase();
if ($player->alliance_id != 0) {
    $db->query("SELECT planet.sector_id as sector, player.game_id as game, time_attack, attacker_damage, planet_damage, trigger_id FROM player, planet, planet_attack WHERE player.game_id = planet.game_id AND " . "owner_id = account_id AND " . "player.game_id = {$player->game_id} AND " . "planet.game_id = {$player->game_id} AND " . "planet.sector_id = planet_attack.sector_id AND " . "planet.game_id = planet_attack.game_id AND " . "alliance_id = {$player->alliance_id} " . "ORDER BY time_attack DESC");
} else {
    $db->query("SELECT planet.sector_id as sector, player.game_id as game, time_attack, attacker_damage, planet_damage, trigger_id FROM player, planet, planet_attack WHERE player.game_id = planet.game_id AND " . "owner_id = account_id AND " . "planet.game_id = {$player->game_id} AND " . "planet.sector_id = planet_attack.sector_id AND " . "planet.game_id = planet_attack.game_id AND " . "player.game_id = {$player->game_id} " . "ORDER BY time_attack DESC");
}
while ($db->next_record()) {
    $game_id = $db->f("game");
    $sector_id = $db->f("sector");
    $time = $db->f("time_attack");
    $attacker = new SMR_PLAYER($db->f("trigger_id"), $player->game_id);
    $att_damage = $db->f("attacker_damage");
    $planet_damage = $db->f("planet_damage");
    $planet = new SMR_PLANET($db->f("sector"), $player->game_id);
    print "Planet <span style=font-variant:small-caps>{$planet->planet_name}</span> is under attack by " . $attacker->get_colored_name() . "<br>";
    print "This shot was at " . date("n/j/Y g:i:s A", $time) . ".  The attacking team did {$att_damage} damage ";
    print "while the planet did {$planet_damage} damage<br><br>";
}
<?php

$action = $_REQUEST['action'];
if ($action == 'Skip >>') {
    $container = array();
    $container['url'] = 'skeleton.php';
    $container['body'] = 'universe_create_ports.php';
    $container['game_id'] = $var['game_id'];
    forward($container);
}
$id = $_REQUEST['id'];
if (!isset($id)) {
    create_error('Error while transmitting data from previous form!');
}
include get_file_loc('universe_create_location.inc');
foreach ($id as $location_type_id => $location_array) {
    // first we deal with race HQ
    if ($location_type_id == GOVERNMENT) {
        foreach ($location_array as $galaxy_id => $hq_type) {
            // 1 means no hq
            if ($hq_type == 1) {
                continue;
            }
            // put actual hq in
            $hq_sector = create_location($var['game_id'], $galaxy_id, GOVERNMENT + $hq_type);
            // ship shop and co (for racials only)
            create_location($var['game_id'], $galaxy_id, RACIAL_SHIPS + $hq_type - 1, $hq_sector);
            create_location($var['game_id'], $galaxy_id, RACIAL_SHOPS + $hq_type - 1, $hq_sector);
            // create fed around hq
            create_fed($var['game_id'], $galaxy_id, $hq_sector);
        }
Beispiel #27
0
<?php

require_once get_file_loc('menu.inc');
if (!isset($var['race_id'])) {
    SmrSession::updateVar('race_id', $player->getRaceID());
}
$raceID = $var['race_id'];
$template->assign('PageTopic', 'Ruling Council Of ' . Globals::getRaceName($raceID));
// echo menu
create_council_menu($raceID);
$RACES =& Globals::getRaces();
$raceRelations =& Globals::getRaceRelations($player->getGameID(), $raceID);
$peaceRaces = array();
$neutralRaces = array();
$warRaces = array();
foreach ($RACES as $otherRaceID => $raceInfo) {
    if ($otherRaceID != RACE_NEUTRAL && $raceID != $otherRaceID) {
        if ($raceRelations[$otherRaceID] >= 300) {
            $peaceRaces[$otherRaceID] = $raceInfo;
        } else {
            if ($raceRelations[$otherRaceID] <= -300) {
                $warRaces[$otherRaceID] = $raceInfo;
            } else {
                $neutralRaces[$otherRaceID] = $raceInfo;
            }
        }
    }
}
$template->assignByRef('PeaceRaces', $peaceRaces);
$template->assignByRef('NeutralRaces', $neutralRaces);
$template->assignByRef('WarRaces', $warRaces);
<?php

require_once get_file_loc($var['HistoryDatabase'] . '.class.inc');
//offer a back button
$container = create_container('skeleton.php', 'games_previous.php');
$container['HistoryDatabase'] = $var['HistoryDatabase'];
$db = new $var['HistoryDatabase']();
$db->query('SELECT * FROM game WHERE game_id = ' . $db->escapeNumber($var['game_id']));
$db->nextRecord();
$game_id = $db->getField('game_id');
$container['game_id'] = $game_id;
$container['game_name'] = $db->getField('game_name');
//get alliance members
$id = $var['alliance_id'];
//$PHP_OUTPUT.=($game_id.','. $id);
$db->query('SELECT * FROM alliance WHERE alliance_id = ' . $db->escapeNumber($id) . ' AND game_id = ' . $db->escapeNumber($game_id));
$db->nextRecord();
$PHP_OUTPUT .= '<div align=center>';
$PHP_OUTPUT .= create_link($container, '<b>&lt;&lt;Back</b>');
$template->assign('PageTopic', 'Alliance Roster - ' . stripslashes($db->getField('alliance_name')));
$PHP_OUTPUT .= '
<table class="standard">
	<tr>
		<th>Player Name</th>
		<th>Experience</th>
		<th>Alignment</th>
		<th>Race</th>
		<th>Kills</th>
		<th>Deaths</th>
		<th>Bounty</th>
	</tr>
Beispiel #29
0
<?php

require_once get_file_loc('smr_sector.inc');
$sector = new SMR_SECTOR($player->sector_id, SmrSession::$game_id, SmrSession::$old_account_id);
$game_id = $player->game_id;
//init file so we can get a size later
$file = "";
//function for writing a ushort
function add2bytes($int)
{
    $temp = pack("c", $int % 256);
    $temp .= pack("c", $int / 256);
    return $temp;
}
function addbyte($int)
{
    return pack("c", $int);
}
//generate the players alliance list...
$alliance = "(0";
$db->query("SELECT * FROM player WHERE alliance_id = {$player->alliance_id} AND alliance_id != 0 LIMIT 1");
while ($db->next_record()) {
    $alliance .= ",";
    $alliance .= $db->f("account_id");
}
$alliance .= ")";
$db->query("SELECT * FROM game WHERE game_id = {$game_id} LIMIT 1");
if ($db->next_record()) {
    $game_name = $db->f("game_name");
}
$file .= "CMF by ^V^ Productions ©2004 ";
Beispiel #30
0
<?php

$template->assign('PageTopic', 'Reply To Reported Messages');
require_once get_file_loc('message.functions.inc');
$container = create_container('notify_reply_processing.php');
transfer('game_id');
transfer('offended');
transfer('offender');
$template->assign('NotifyReplyFormHref', SmrSession::getNewHREF($container));
$offender =& getMessagePlayer($var['offender'], $var['game_id']);
$offended =& getMessagePlayer($var['offended'], $var['game_id']);
if (is_object($offender)) {
    $template->assignByRef('OffenderAccount', SmrAccount::getAccount($var['offender']));
}
if (is_object($offended)) {
    $template->assignByRef('OffendedAccount', SmrAccount::getAccount($var['offended']));
}
$template->assignByRef('Offender', $offender);
$template->assignByRef('Offended', $offended);
if (isset($var['PreviewOffender'])) {
    $template->assign('PreviewOffender', $var['PreviewOffender']);
}
if (isset($var['OffenderBanPoints'])) {
    $template->assign('OffenderBanPoints', $var['OffenderBanPoints']);
}
if (isset($var['PreviewOffended'])) {
    $template->assign('PreviewOffended', $var['PreviewOffended']);
}
if (isset($var['OffendedBanPoints'])) {
    $template->assign('OffendedBanPoints', $var['OffendedBanPoints']);
}