Пример #1
0
        $port_info[$good_id] = $transaction;
    }
    //insert the last port
    $db2->query("REPLACE INTO player_visited_port (account_id, game_id, sector_id, visited, port_info) " . "VALUES({$account_id}, {$game_id}, {$current_sector_id}, {$current_time}, '" . addslashes(serialize($port_info)) . "')");
    //offer another drink and such
    print "<div align=center>Galaxy Info has been added.  Enjoy!</div><br>";
    include get_file_loc("bar_opening.php");
} else {
    //find what gal they want
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "bar_main.php";
    $container["script"] = "bar_galmap_buy.php";
    $container["process"] = "yes";
    print "<div align=center>What galaxy do you want info on?<br>";
    print_form($container);
    print "<select type=select name=gal_id>";
    print "<option value=0>[Select a galaxy]</option>";
    $db->query("SELECT galaxy_id FROM sector WHERE game_id = {$player->game_id} GROUP BY galaxy_id ORDER BY galaxy_id ASC");
    $db2 = new SmrMySqlDatabase();
    while ($db->next_record()) {
        $gal_id = $db->f("galaxy_id");
        $db2->query("SELECT * FROM galaxy WHERE galaxy_id = {$gal_id}");
        if ($db2->next_record()) {
            print "<option value={$gal_id}>" . $db2->f("galaxy_name") . "</option>";
        }
    }
    print "</select><br>";
    print_submit("Buy the map");
    print "</form></div>";
}
Пример #2
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->next_record()) {
     $CurrByte = 128;
 } else {
     $CurrByte = 0;
 }
 // locations
 $db2->query("SELECT * FROM location NATURAL JOIN location_type WHERE game_id = {$game_id} AND sector_id = {$sector_id} LIMIT 1");
 $CurrByte += $db2->nf();
 $file .= addbyte($CurrByte);
 // warp
 $db3->query("SELECT * FROM warp WHERE game_id = {$game_id} AND (sector_id_1 = {$sector_id} OR sector_id_2 = {$sector_id}) LIMIT 1");
 if ($db3->next_record()) {
     $warp_id = $db3->f("sector_id_1") == $sector_id ? $db3->f("sector_id_2") : $db3->f("sector_id_1");
     $file .= add2bytes($warp_id);
 }
 while ($db2->next_record()) {
Пример #3
0
        echo '<div align=center>';
        echo '<table cellspacing="0" cellpadding="0" class="standard inset" ><tr><th>ID</th><th>Password</th><th>Last Transaction</th><th>Balance</th><th>Option</th></tr>';
        $container = array();
        $container["url"] = "skeleton.php";
        $container["body"] = "bank_anon.php";
        $db2 = new SmrMySqlDatabase();
        while ($db->next_record()) {
            $db2->query('SELECT MAX(time) FROM anon_bank_transactions
						WHERE game_id=' . $player->game_id . '
						AND anon_id=' . $db->f('anon_id') . ' LIMIT 1');
            echo '<tr><td class="shrink center">';
            echo $db->f("anon_id");
            echo '</td><td>';
            echo $db->f("password");
            echo '</td><td class="shrink nowrap">';
            if ($db2->next_record() && $db2->f('MAX(time)')) {
                echo date('n/j/Y g:i:s A', $db2->f('MAX(time)'));
            } else {
                echo 'No transactions';
            }
            echo '</td><td class="right shrink">';
            echo $db->f("amount");
            echo '</td><td class="button">';
            $container["account_num"] = $db->f("anon_id");
            $container["password"] = $db->f("password");
            print_button($container, 'Access Account');
            echo '</td></tr>';
        }
        echo '</table></div><br>';
    }
    $container = array();
Пример #4
0
$container["url"] = "skeleton.php";
$container["body"] = "hall_of_fame_new.php";
if (isset($game_id)) {
    $container["game_id"] = $game_id;
}
print_link($container, "<b>&lt;&lt;Back</b>");
print "<br>";
print "Here are the ranks of players by {$cat} {$action}<br><br>";
print_table();
print "<tr><th align=center>Rank</th><th align=center>Player</th><th align=center>{$cat} {$action}</th></tr>";
if ($cat == "<b>Money Donated to SMR</b>") {
    $db->query("SELECT account_id, sum(amount) as amount FROM account_donated " . "GROUP BY account_id ORDER BY amount DESC LIMIT 25");
} else {
    $db->query("SELECT account_id, {$row} as amount FROM {$table} {$row} > 0 ORDER BY amount DESC LIMIT 25");
}
while ($db->next_record()) {
    $this_acc = new SMR_ACCOUNT();
    $this_acc->get_by_id($db->f("account_id"));
    if ($db->f("account_id") == ".SmrSession::{$old_account_id}.") {
        $bold = " style=\"font-weight:bold;\"";
    } else {
        $bold = "";
    }
    print "<tr>";
    print "<td align=center{$bold}>" . $rank++ . "</td>";
    //link to stat page
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "hall_of_fame_player_detail.php";
    $container["acc_id"] = $db->f("account_id");
    if (isset($game_id)) {
Пример #5
0
print "<th>Cost</th>";
print "<th>Build</th>";
print "</tr>";
// get game speed
$db->query("SELECT * FROM game WHERE game_id = {$player->game_id}");
if ($db->next_record()) {
    $game_speed = $db->f("game_speed");
}
$db2 = new SmrMySqlDatabase();
$db->query("SELECT * FROM planet_construction ORDER BY construction_id");
while ($db->next_record()) {
    $construction_id = $db->f("construction_id");
    $construction_name = $db->f("construction_name");
    $construction_description = $db->f("construction_description");
    $db2->query("SELECT * FROM planet_cost_credits WHERE construction_id = {$construction_id}");
    if ($db2->next_record()) {
        $cost = $db2->f("amount");
    }
    /*$container = array();
    	$container["url"] = "planet_construction_processing.php";
    	$container["construction_id"] = $construction_id;
    	$container["cost"] = $cost;
    
    	print_form($container);*/
    print "<tr>";
    print "<td>{$construction_name}</td>";
    print "<td>{$construction_description}</td>";
    print "<td align=\"center\">";
    print $planet->construction[$construction_id];
    print "/";
    print $planet->max_construction[$construction_id];
Пример #6
0
 $curr_attacker->relations[$port->race_id] -= 5;
 if ($curr_attacker->relations[$port->race_id] < -500) {
     $curr_attacker->relations[$port->race_id] = -500;
 }
 // save what we got so far
 $curr_attacker->update();
 // disable cloak
 $curr_attacker_ship->disable_cloak();
 // the damage this attacker is going to do
 $attacker_damage = 0;
 // and his message array
 $damage_msg = array();
 $weapon = new SmrMySqlDatabase();
 $weapon->query("SELECT * FROM ship_has_weapon NATURAL JOIN weapon_type " . "WHERE account_id = {$curr_attacker->account_id} AND " . "game_id = {$curr_attacker->game_id} " . "ORDER BY order_id");
 // iterate over all existing weapons
 while ($weapon->next_record()) {
     //vars
     $weapon_name = $weapon->f("weapon_name");
     $shield_damage = $weapon->f("shield_damage");
     $armor_damage = $weapon->f("armor_damage");
     $accuracy = $weapon->f("accuracy");
     // calc accuracy for this weapon
     $hit = round($accuracy + $curr_attacker->level_id - $port->level / 2);
     // did we hit with this weapon?
     if (mt_rand(0, 100) < $hit) {
         // does the port has shields?
         if ($port->shields > 0) {
             if ($shield_damage > 0) {
                 // do we do more damage than shields left?
                 if ($shield_damage > $port->shields) {
                     $shield_damage = $port->shields;
Пример #7
0
print "<th>Rank</th>";
print "<th>Race</th>";
print "<th>Total Experience</th>";
print "<th>Average Experience</th>";
print "<th>Total Traders</th>";
print "</tr>";
$rank = 0;
$db2 = new SmrMySqlDatabase();
$db->query("SELECT player.race_id as race_id, race_name, sum(player_cache.experience) as experience_sum, count(player_cache.account_id) as members FROM player,player_cache NATURAL JOIN race WHERE race.race_id = player.race_id AND (player_cache.account_id = player.account_id AND player_cache.game_id = {$player->game_id}) AND player.game_id = {$player->game_id} GROUP BY player.race_id ORDER BY experience_sum DESC");
while ($db->next_record()) {
    $rank++;
    $race_id = $db->f("race_id");
    $db2->query("SELECT * FROM player WHERE race_id = {$race_id} AND game_id = {$player->game_id} AND out_of_game = 'TRUE'");
    if ($player->race_id == $race_id) {
        $style = " style=\"font-weight:bold;\"";
    } elseif ($db2->next_record()) {
        $style = " style=\"color:red;\"";
    } else {
        $style = "";
    }
    if ($db2->next_record()) {
        $style .= (print "<tr>");
    }
    print "<td align=\"center\"{$style}>{$rank}</td>";
    print "<td align=\"center\"{$style}>" . $db->f("race_name") . "</td>";
    print "<td align=\"center\"{$style}>" . $db->f("experience_sum") . "</td>";
    print "<td align=\"center\"{$style}>" . round($db->f("experience_sum") / $db->f("members")) . "</td>";
    print "<td align=\"center\"{$style}>" . $db->f("members") . "</td>";
    print "</tr>";
}
print "</table>";
Пример #8
0
 if ($db->nf()) {
     //we have people who meet this category
     print_table();
     print "<tr>";
     print "<th align=\"center\">Rank</th>";
     print "<th align=\"center\">Player</th>";
     print "<th align=\"center\">{$second_display}</th>";
     print "</tr>";
     $count = 1;
     $db4 = new SmrMySqlDatabase();
     while ($db->next_record()) {
         //get the account
         $curr_account = new SMR_ACCOUNT();
         $acc_id = $db->f("account_id");
         $db4->query("SELECT * FROM account WHERE account_id = {$acc_id}");
         if (!$db4->next_record()) {
             continue;
         }
         $curr_account->get_by_id($db->f("account_id"));
         $name = stripslashes($curr_account->HoF_name);
         print "<tr>";
         print "<td align=\"center\">{$count}</td>";
         $count++;
         print "<td align=center>{$name}</td>";
         print "<td align=center> " . number_format($db->f("{$id}") / $db->f("{$per}"), 2) . " </td>";
         print "</tr>";
     }
     print "</table>";
     print "<br><br>";
     print_table();
     print "<tr>";
    $container["url"] = "skeleton.php";
    $container["body"] = "galactic_post_view_article.php";
    transfer("id");
    print_form($container);
    print_submit("No");
    print "</form>";
} else {
    $db->query("SELECT * FROM galactic_post_paper WHERE game_id = {$player->game_id} AND paper_id = {$var['id']}");
    $db->next_record();
    $title = $db->f("title");
    print "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 = {$player->game_id} AND paper_id = {$var['id']}");
    while ($db2->next_record()) {
        $article_id = $db2->f("article_id");
        $db3->query("SELECT * FROM galactic_post_article WHERE game_id = {$player->game_id} AND article_id = {$article_id}");
        $db3->next_record();
        $article_title = stripslashes($db3->f("title"));
        print "{$article_title}<br>";
    }
    print "<br>";
    $container = array();
    $container["url"] = "galactic_post_delete.php";
    transfer("paper");
    transfer("id");
    print_form($container);
    print_submit("Yes");
    print "</form>";
    $container = array();
    $container["url"] = "skeleton.php";
    $container["body"] = "galactic_post_view_article.php";
    transfer("id");
Пример #10
0
<?php

$container = array();
$container['url'] = 'skeleton.php';
$container['body'] = 'message_blacklist.php';
if (!isset($_REQUEST['PlayerName'])) {
    $container['error'] = 1;
    forward($container);
    exit;
}
$player_name = mysql_real_escape_string($_REQUEST['PlayerName']);
$db = new SmrMySqlDatabase();
$db->query('SELECT account_id FROM player WHERE player_name=\'' . $player_name . '\' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
if (!$db->next_record()) {
    $container['error'] = 1;
    forward($container);
    exit;
}
$blacklisted_id = $db->f('account_id');
$db->query('SELECT account_id FROM message_blacklist WHERE account_id=' . SmrSession::$old_account_id . ' AND blacklisted_id=' . $blacklisted_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
if ($db->next_record()) {
    $container['error'] = 2;
    forward($container);
    exit;
}
$db->query('INSERT INTO message_blacklist (game_id,account_id,blacklisted_id) VALUES (' . SmrSession::$game_id . ',' . SmrSession::$old_account_id . ',' . $blacklisted_id . ')');
$container['error'] = 3;
forward($container);
Пример #11
0
 print "<th align=\"center\">";
 print_link($container, "<span style=\"color:#80C870;\">Scout Drones</span>");
 print "</th>";
 $container["category"] = "mines";
 print "<th align=\"center\">";
 print_link($container, "<span style=\"color:#80C870;\">Mines</span>");
 print "</th>";
 $container["category"] = "expire_time";
 print "<th align=\"center\">";
 print_link($container, "<span style=\"color:#80C870;\">Expire time</span>");
 print "</th>";
 print "</tr>";
 while ($db->next_record()) {
     $force_sector = $db->f("sector_id");
     $db2->query("SELECT * FROM sector WHERE sector_id = {$force_sector} AND game_id = {$player->game_id}");
     $db2->next_record();
     $gal_id = $db2->f("galaxy_id");
     $db2->query("SELECT * FROM galaxy WHERE galaxy_id = {$gal_id}");
     $db2->next_record();
     $galaxy_name = $db2->f("galaxy_name");
     $force_sd = $db->f("scout_drones");
     $force_cd = $db->f("combat_drones");
     $force_mine = $db->f("mines");
     $force_time = $db->f("expire_time");
     print "<tr>";
     print "<td align=\"center\">{$force_sector} ({$galaxy_name})</td>";
     print "<td align=\"center\">{$force_cd}</td>";
     print "<td align=\"center\">{$force_sd}</td>";
     print "<td align=\"center\">{$force_mine}</td>";
     print "<td align=\"center\">" . date("n/j/Y g:i:s A", $force_time) . "</td>";
     print "</tr>";
Пример #12
0
function do_voodoo()
{
    ob_clean();
    global $lock, $var;
    foreach ($GLOBALS as $key => $value) {
        ${$key} =& $GLOBALS[$key];
    }
    // initialize objects we usually need, like player, ship
    if (SmrSession::$game_id > 0) {
        $db = new SmrMySqlDatabase();
        // We need to acquire locks BEFORE getting the player information
        // Otherwise we could be working on stale information
        $db->query('SELECT sector_id FROM player WHERE account_id=' . SmrSession::$old_account_id . ' AND game_id=' . SmrSession::$game_id . ' LIMIT 1');
        $db->next_record();
        $sector_id = $db->f('sector_id');
        if (!$lock && $var['body'] != 'error.php' && !isset($var['ForwardError'])) {
            if (!acquire_lock($sector_id)) {
                create_error("Failed to acquire sector lock");
            }
        }
        // Now that they've acquire a lock we can move on
        $player = new SMR_PLAYER(SmrSession::$old_account_id, SmrSession::$game_id);
        if ($player->dead == 'TRUE' && $var['body'] != 'death.php' && !isset($var['override_death'])) {
            $container = array();
            $container["url"] = "skeleton.php";
            $container["body"] = "death.php";
            forward($container);
        }
        $ship = new SMR_SHIP(SmrSession::$old_account_id, SmrSession::$game_id);
        // update turns on that player
        $player->update_turns($ship->speed);
        if ($player->newbie_turns <= 20 && $player->newbie_warning == "TRUE" && $var["body"] != "newbie_warning.php") {
            forward(create_container("skeleton.php", "newbie_warning.php"));
        }
    }
    require get_file_loc($var["url"]);
    SmrSession::update();
    if ($lock) {
        release_lock($lock);
    }
    exit;
}
Пример #13
0
    // test if we are searched. (but only if we hadn't a previous trade here
} elseif ($player->controlled != $player->sector_id) {
    $db->query("SELECT * FROM port_has_goods " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id} AND " . "(good_id = 5 OR good_id = 9 OR good_id = 12)");
    $base_chance = 15 - $db->nf() * 4;
    if ($ship->ship_type_id == 23 || $ship->ship_type_id == 24 || $ship->ship_type_id == 25) {
        $base_chance -= 4;
    }
    $rand = mt_rand(1, 100);
    if ($rand <= $base_chance) {
        if (!empty($ship->cargo[5]) || !empty($ship->cargo[9]) || !empty($ship->cargo[12])) {
            //find the fine
            //get base for ports that dont happen to trade that good
            $query = new SmrMySqlDatabase();
            $query->query("SELECT * FROM good WHERE good_id = 5 OR good_id = 9 OR good_id = 12");
            $base = array();
            while ($query->next_record()) {
                $base[$query->f("good_id")] = $query->f("base_price");
            }
            $fine = $port->level * ($ship->cargo[5] * $base[5] + $ship->cargo[9] * $base[9] + $ship->cargo[12] * $base[12]);
            $player->credits -= $fine;
            if ($player->credits < 0) {
                // because credits is 0 it will take money from bank
                $player->bank += $player->credits;
                // set credits to zero
                $player->credits = 0;
                // leave insurance
                if ($player->bank < 5000) {
                    $player->bank = 5000;
                }
            }
            print "<span style=\"color:red;\">The Federation searched your ship and illegal goods were found!</span><br>";
$attacker_total_msg = array();
$attacker_msg = array();
if ($player->getAllianceID() != 0) {
    $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'alliance_id = ' . $player->getAllianceID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0 ' . 'ORDER BY rand() LIMIT 10');
} else {
    $db->query('SELECT * FROM player ' . 'WHERE game_id = ' . $player->getGameID() . ' AND ' . 'sector_id = ' . $player->getSectorID() . ' AND ' . 'account_id = ' . $player->getAccountID() . ' AND ' . 'land_on_planet = \'FALSE\' AND ' . 'newbie_turns = 0');
}
$db2 = new SmrMySqlDatabase();
while ($db->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) {
    $curr_attacker =& SmrPlayer::getPlayer($db->f('account_id'), SmrSession::$game_id);
    $curr_attacker_ship = new SMR_SHIP($db->f('account_id'), SmrSession::$game_id);
    // disable cloak
    $curr_attacker_ship->disable_cloak();
    $db2->query('SELECT * FROM ship_has_weapon, weapon_type ' . 'WHERE account_id = ' . $curr_attacker->getAccountID() . ' AND ' . 'game_id = ' . SmrSession::$game_id . ' AND ' . 'ship_has_weapon.weapon_type_id = weapon_type.weapon_type_id ' . 'ORDER BY order_id');
    // iterate over all existing weapons
    while ($db2->next_record() && ($forces->hasCDs() || $forces->hasSDs() || $forces->hasMines())) {
        $weapon_name = $db2->f('weapon_name');
        $shield_damage = $db2->f('shield_damage');
        $armour_damage = $db2->f('armour_damage');
        $accuracy = $db2->f('accuracy');
        if ($forces->hasMines()) {
            if ($armour_damage > 0) {
                // mines take 20 armour damage each
                $mines_dead = round($armour_damage / 20);
                // more damage than mines?
                if ($mines_dead > $forces->getMines()) {
                    $mines_dead = $forces->getMines();
                }
                // subtract mines that died
                $forces->takeMines($mines_dead);
                // add damage we did
Пример #15
0
$attacker_total_msg = array();
$attacker_msg = array();
if ($player->alliance_id != 0) {
    $db->query("SELECT * FROM player " . "WHERE game_id = {$player->game_id} AND " . "alliance_id = {$player->alliance_id} AND " . "sector_id = {$player->sector_id} AND " . "land_on_planet = 'FALSE' AND " . "newbie_turns = 0 " . "ORDER BY rand() LIMIT 10");
} else {
    $db->query("SELECT * FROM player " . "WHERE game_id = {$player->game_id} AND " . "sector_id = {$player->sector_id} AND " . "account_id = {$player->account_id} AND " . "land_on_planet = 'FALSE' AND " . "newbie_turns = 0");
}
$db2 = new SmrMySqlDatabase();
while ($db->next_record() && ($forces->combat_drones > 0 || $forces->scout_drones > 0 || $forces->mines > 0)) {
    $curr_attacker = new SMR_PLAYER($db->f("account_id"), SmrSession::$game_id);
    $curr_attacker_ship = new SMR_SHIP($db->f("account_id"), SmrSession::$game_id);
    // disable cloak
    $curr_attacker_ship->disable_cloak();
    $db2->query("SELECT * FROM ship_has_weapon, weapon_type " . "WHERE account_id = {$curr_attacker->account_id} AND " . "game_id = " . SmrSession::$game_id . " AND " . "ship_has_weapon.weapon_type_id = weapon_type.weapon_type_id " . "ORDER BY order_id");
    // iterate over all existing weapons
    while ($db2->next_record() && ($forces->combat_drones > 0 || $forces->scout_drones > 0 || $forces->mines > 0)) {
        $weapon_name = $db2->f("weapon_name");
        $shield_damage = $db2->f("shield_damage");
        $armor_damage = $db2->f("armor_damage");
        $accuracy = $db2->f("accuracy");
        if ($forces->mines > 0) {
            if ($armor_damage > 0) {
                // mines take 20 armor damage each
                $mines_dead = round($armor_damage / 20);
                // more damage than mines?
                if ($mines_dead > $forces->mines) {
                    $mines_dead = $forces->mines;
                }
                // subtract mines that died
                $forces->mines -= $mines_dead;
                // add damage we did