Example #1
0
                //ship is turned on.
                dbn("update se_admin_ships set {$db_name}_ship_status = 1 where ship_type_id = '{$list_ships['type_id']}'");
            }
        }
        $out .= "Selected ships have now been made available to the players. The rest of the ships are un-available.";
    } else {
        $out .= "Select the ships that you would like users to be able to use within the game:";
        $out .= "\n<form name='select_ships' action='{$_SERVER['PHP_SELF']}' method='POST'>";
        $out .= "\n<input type='hidden' name='admin_choose' value='1' />";
        $out .= make_table(array("<b class='b1'>Ship Name</b>", "Available"));
        db("select s.type_id,s.name,a.{$db_name}_ship_status as status from se_ship_types s, se_admin_ships a where s.type_id > 2 && a.ship_type_id = s.type_id && s.auction = 0");
        while ($list_ships = dbr(1)) {
            if ($list_ships['status'] == 1) {
                $out .= "\n" . quick_row("{$list_ships['name']}", "<input type='checkbox' name='add_ship[{$list_ships['type_id']}]' value='{$list_ships['type_id']}' checked='checked' />");
            } else {
                $out .= "\n" . quick_row("{$list_ships['name']}", "<input type='checkbox' name='add_ship[{$list_ships['type_id']}]' value='{$list_ships['type_id']}' />");
            }
        }
        $out .= "\n</table>";
        $out .= "\n<br /><a href='javascript:TickAll(\"select_ships\")'>Invert Ship Selection</a>";
        $out .= "\n<p /><input type='submit' value='Submit' /></form>";
    }
    print_page("Ship Types", $out);
    insert_history($user['login_id'], "Ships available in game changed.");
}
#list all admin options
db("select paused from se_games where db_name = '{$db_name}'");
$paused = dbr(1);
$out .= "Game Functions:<br />";
if (!$paused['paused']) {
    $out .= "<a href='{$_SERVER['PHP_SELF']}?pause=1'>Pause Game</a><br />";
Example #2
0
function config_list($details, $lookup = -1)
{
    //empty config, so return nothing.
    if ($lookup == "") {
        return $cw['None'];
    }
    $temp_where = "";
    //list selected $lookup configs, rather than all
    if ($lookup != -1) {
        $temp_where = " where ";
        //loop through all entries in lookup and add them to the where
        foreach (explode(",", $lookup) as $val) {
            $temp_where .= "config_id = '{$val}' || ";
        }
        $temp_where = preg_replace("/\\|\\| \$/", "", $temp_where);
    }
    $ret_str = "";
    db("select * from se_config_list {$temp_where}");
    //showing only title of configs.
    if ($details == 0) {
        while ($list_conf = dbr(1)) {
            $ret_str .= $list_conf['short_for'] . "<br />";
        }
        //showing all info about the configs.
    } else {
        //make tables with all information for all of resultaint configs.
        while ($list_conf = dbr(1)) {
            $ret_str .= make_table(array("", ""), "WIDTH=95%");
            $ret_str .= quick_row($st[1142], $list_conf['config_id']);
            $ret_str .= quick_row($st[1143], $list_conf['short_for']);
            $ret_str .= quick_row($st[1144], $list_conf['type']);
            $ret_str .= quick_row($st[1145], $list_conf['description']);
            $ret_str .= quick_row($st[1146], $list_conf['does_to_ship']);
            $ret_str .= "</table><br />";
        }
    }
    return $ret_str;
}
Example #3
0
$error_str = "";
// change player options
if (isset($_GET['player_op']) && $_GET['player_op'] == 1) {
    $error_str .= $st[925];
    $error_str .= make_table(array("", ""));
    $error_str .= "<form method='post' action='options.php'>";
    if ($user['login_id'] != 1 && $user['login_id'] != OWNER_ID) {
        #admins can't alter icq etc.
        $error_str .= quick_row("<br />" . $st[926] . ":", " <input type='text' name='aim' value='{$p_user['aim']}' />");
        $error_str .= quick_row("<br />" . $st[927] . " #:", " <input type='text' name='icq' value='{$p_user['icq']}' />");
        $error_str .= quick_row("<br />" . $st[928] . ":", " <input type='text' name='yim' value='{$p_user['yim']}' />");
        $error_str .= quick_row("<br />" . $st[929] . ":", " <input type='text' name='msn' value='{$p_user['msn']}' />");
    } else {
        $error_str .= "<br />" . $st[930] . "<br />";
    }
    $error_str .= quick_row($st[931], "<p />" . $cw['note'] . ": <b class='b1'>" . $st[932] . "<br /><textarea name=sig cols=25 rows=10>" . stripslashes($user['sig']) . "</textarea>");
    $error_str .= "</table><input type='hidden' name='player_op' value='2' /><br /><br />";
    $error_str .= "<input type='submit' name='submit' /></form><br /><br />";
    print_page($st[933], $error_str);
} elseif (isset($_POST['player_op']) && $_POST['player_op'] == 2) {
    if ($user['login_id'] != 1) {
        #admins can't alter icq etc
        dbn("update user_accounts set aim = '" . mysql_escape_string(strip_tags((string) $_POST['aim'])) . "', icq = '" . (int) $_POST['icq'] . "', yim = '" . mysql_escape_string(strip_tags((string) $_POST['yim'])) . "', msn = '" . mysql_escape_string(strip_tags((string) $_POST['msn'])) . "' where login_id = '{$user['login_id']}'");
    }
    dbn("update {$db_name}_users set sig = '" . mysql_escape_string(strip_tags((string) $_POST['sig'])) . "' where login_id = '{$user['login_id']}'");
    $error_str .= $st[934];
}
#save changes to vars
if (isset($_POST['save_vars'])) {
    foreach ($_POST as $var => $value) {
        $option_check = "";
Example #4
0
        }
        $out_str .= "</table></td><td>";
        //new grid
        $out_str .= make_table(array("", ""));
        $out_str .= quick_row("Kills", $ct[4]);
        $out_str .= quick_row("Kills Average", round($ct[4] * 100 / $ct[0] / 100));
        $out_str .= quick_row("Fighters Killed", $ct['killed_fighters']);
        $out_str .= quick_row("Fighters Killed Average", round($ct['killed_fighters'] * 100 / $ct[0] / 100));
        $out_str .= quick_row("Fighters Lost", $ct['lost_fighters']);
        $out_str .= quick_row("Fighters Lost Average", round($ct['lost_fighters'] * 100 / $ct[0] / 100));
        $out_str .= "</table><br />";
        $out_str .= make_table(array("", ""));
        $out_str .= quick_row("Clans", "<b>{$ct5['0']}</b>");
        $out_str .= quick_row("Total Clan <br />Membership", $ct5[1]);
        if ($ct5[1] > 0) {
            $out_str .= quick_row("Average Clan <br />Membership", round($ct5[1] * 100 / $ct5[0] / 100));
        }
        $out_str .= "</table><br /><br />";
        $out_str .= "</table><br /><br />";
    }
    print_page("GameDetails", $out_str);
    //optimise the DB tables.
} elseif (isset($_GET['optimise'])) {
    $tables_str = "";
    $counter = 0;
    //select all tables from the DB
    $table_result = mysql_list_tables(DATABASE);
    while ($row = mysql_fetch_row($table_result)) {
        $tables_str .= " `{$row['0']}`, ";
        $counter++;
    }
Example #5
0
        $temp_str .= quick_row($cw['colonists'], $res1['colon']);
        $temp_str .= quick_row("&nbsp;", "");
        $temp_str .= quick_row($cw['ships'], calc_perc($res2['ships'], $maths2['ships']));
        $temp_str .= quick_row($cw['ship_fighters'], calc_perc($res2['sfigs'], $maths2['sfigs']));
        $temp_str .= quick_row($cw['fleet_fighter_capacity'], $res2['max_figs'] . "" . $cw['fighters'] . "");
        $temp_str .= quick_row("Fleet Cargo Capacity", $res2['cargo'] . " Units");
        $temp_str .= quick_row("&nbsp;", "");
        $temp_str .= quick_row($cw['genesis_devices'], $res3['gen']);
        if ($GAME_VARS['uv_planets'] >= 0) {
            $temp_str .= quick_row($cw['terra_imploders'], $res3['imploder']);
        }
        if ($GAME_VARS['bomb_flag'] < 2) {
            $temp_str .= quick_row($cw['alpha_bombs'], $res3['alpha']);
            $temp_str .= quick_row($cw['gamma_bombs'], $res3['gamma']);
        }
        $temp_str .= quick_row($cw['delta_bombs'], $res3['delta']);
    }
    $temp_str .= "</table><br />";
    print_page($cw['clan_info'], $temp_str . $x_link);
} else {
    // print normal page for clan-member
    db("select * from {$db_name}_clans where clan_id = {$user['clan_id']}");
    $clan = dbr(1);
    $clan_name = stripslashes($clan['clan_name']);
    #change a ship's fleet
    if (isset($fleet_type) && $user['login_id'] == $clan['leader_id']) {
        if ($join_fleet_id_2 != 0) {
            $join_fleet_id = $join_fleet_id_2;
        }
        $error_str .= "<br />" . change_fleet_num($join_fleet_id, 1, $do_ship, "ship_id") . "<p /><br />";
    }
Example #6
0
         $output_str .= make_row(array($cw['metal'], $star['metal'], $planet['drones_alloc_metal']));
         $output_str .= make_row(array($cw['fuel'], $star['fuel'], $planet['drones_alloc_fuel']));
         $output_str .= make_row(array($cw['unallocated_drones'], $unalloc, "<a href='{$_SERVER['PHP_SELF']}?allocate_mining_drones=1&planet_id={$planet_id}'>" . $st[1699] . "</a>"));
         $output_str .= "</table>";
         if ($planet['mining_drones'] < $max_drones) {
             $output_str .= "<a href='{$_SERVER['PHP_SELF']}?more_drones=1&planet_id={$planet_id}'>" . $st[1700] . "</a>";
         }
     } else {
         $output_str .= "<a href='{$_SERVER['PHP_SELF']}?more_drones=1&planet_id={$planet_id}'>" . $st[1701] . "</a>";
     }
 }
 $output_str .= "<p /><br /><table><tr><td>" . $st[1702] . "</tr></td><form name=pop_set_form method=post action=planet.php><input type=hidden name=planet_id value='{$planet_id}' /><input type=hidden name=assinging value='1' />";
 $output_str .= quick_row($cw['tax_rate'], "6% (" . $st[1703] . ")");
 $output_str .= quick_row($st[1704], idle_colonists());
 $output_str .= quick_row($st[1705], "<input type=text name=num_pop_set_1 value='{$planet['alloc_fight']}' size=6 />");
 $output_str .= quick_row($st[1706], "<input type=text name=num_pop_set_2 value='{$planet['alloc_elect']}' size=6 />");
 $output_str .= "<tr><td><input type='submit' value='" . $cw['set'] . "' /></td><td><input type=reset value=Reset /></td></tr></form>";
 $output_str .= "</table><br />";
 if ($GAME_VARS['uv_num_bmrkt'] > 0 && $planet['research_fac'] == 0 && avail_check(4000)) {
     $output_str .= "<p /><a href='add_planetary.php?planet_id={$planet_id}&research_fac=1'>" . $st[1707] . "</a> - <b>{$research_fac_cost}</b> - " . popup_help("help.php?topic=Blackmarkets&sub_topic=Research_Facilities_and_Support_Units&popup=1", 500, 400);
 }
 if (!$planet['shield_gen'] && avail_check(3000)) {
     $output_str .= "<p /><a href='add_planetary.php?planet_id={$planet_id}&shield_gen=1'>" . $st[1708] . "</a> - <b>{$shield_gen_cost}</b> - " . popup_help("help.php?topic=Planets&popup=1&sub_topic=Shield_Generators", 400, 220);
 } elseif ($planet['shield_gen'] && avail_check(3000)) {
     $t545 = $planet['shield_gen'] * 1000;
     $output_str .= "<p />" . $st[1709] . ": <b>{$planet['shield_charge']}</b> / <b>{$t545}</b> - <a href='planet.php?planet_id={$planet_id}&all_shield=1'>" . $st[1710] . "</a>";
 }
 db("select * from {$db_name}_planets where planet_id = '{$user['on_planet']}'");
 $planet = dbr();
 if (($user['login_id'] == $planet['login_id'] || $user['clan_id'] == $planet['clan_id']) && ($GAME_VARS['uv_planets'] < 0 || $user['terra_imploder'] > 0)) {
     $output_str .= "<p /><a href='planet.php?planet_id={$planet_id}&destroy=1'>" . $cw['destroy'] . " {$planet['planet_name']}</a>";
Example #7
0
    }
}
$text .= quick_row("&nbsp;", "");
$text .= quick_row($st[1528], array_sum($bug_status));
if (array_sum($bug_status) > 0) {
    $text .= quick_row($st[1529], $bug_status['10']);
    $text .= quick_row($st[1530], $bug_status['outstanding']);
    $text .= quick_row($st[1531], $bug_status['31']);
    $text .= quick_row($cw['left'], $bug_status['32']);
    $text .= quick_row($cw['duplicates'], $bug_status['33']);
    $text .= quick_row($cw['invalid'], $bug_status['34']);
    $text .= quick_row($cw['feature'], $bug_status['35']);
}
$signature_filtree = $player['signature'];
$signature_filtree = strip_tags($signature_filtree, '<b><i><img><marquee><font><center>');
$text .= quick_row('Signature ', nl2br($signature_filtree));
$text .= "</table><br />";
if ($full) {
    if (isset($sort_planets)) {
        if ($sorted_planets == 1) {
            $going = "asc";
            $sorted_planets = 2;
        } else {
            $going = "desc";
            $sorted_planets = 1;
        }
        db("select planet_name,location,fighters,colon,cash,metal,fuel,elect,mining_drones from {$db_name}_planets where login_id = '{$target}' order by '{$sort_planets}' {$going}");
    } else {
        db("select planet_name,location,fighters,colon,cash,metal,fuel,elect,mining_drones from {$db_name}_planets where login_id = '{$target}' order by fighters desc, planet_name asc, location desc");
        $sorted_planets = "";
    }
Example #8
0
    $out_str .= quick_row($cw['turn_cost'], $st[872]);
    $out_str .= "</table><br />" . $st[873];
    $out_str .= "<br /><br /><br /><b><a name=misc_command>" . $cw['commanding_ships'] . "</a></b><br />" . $st[874];
    $help_type = $st[875];
} elseif (isset($_GET['tools'])) {
    $help_type = $cw['tools'];
    if (empty($GAME_VARS)) {
        $out_str .= $st[876];
    } else {
        $out_str .= "<center><b>" . $st[877] . "</b></center><br />" . sprintf($st[878], $game_info[name]);
        $out_str .= "<br />" . $st[879] . "<br />";
        $out_str .= make_table(array($cw['item'], $st[880]));
        $out_str .= quick_row($cw['fighters'], "{$GAME_VARS['fighter_cost_earth']}");
        $out_str .= quick_row($cw['metal'], "{$GAME_VARS['buy_metal']}");
        $out_str .= quick_row($cw['fuel'], "{$GAME_VARS['buy_fuel']}");
        $out_str .= quick_row($cw['electronics'], "{$GAME_VARS['buy_elect']}");
        $out_str .= "</table>";
        $out_str .= "<p /><br />" . $st[881];
        $out_str .= make_table(array($cw['item'], $cw['materials_required'], $st[882], $st[883], $st[884]));
        $num_e = 60;
        $num_f = 60;
        $total_cos_figs = ($GAME_VARS['buy_elect'] + $GAME_VARS['buy_metal'] * 3 + $GAME_VARS['buy_fuel'] * 2) * 10;
        $out_str .= make_row(array($cw['fighter'], "10 " . $cw['electronics'] . ", 30 " . $cw['metals'] . ", 20 " . $cw['fuels'], "60", $total_cos_figs, $avg_f_cost = $total_cos_figs / $num_f));
        $total_cos_elect = ($GAME_VARS['buy_metal'] * 4 + $GAME_VARS['buy_fuel'] * 3) * 20;
        $out_str .= make_row(array($cw['electronics'], "80 " . $cw['metals'] . ", 60 " . $cw['fuels'], "60", $total_cos_elect, $avg_e_cost = $total_cos_elect / $num_e));
        $out_str .= "</table><p />";
        $out_str .= $st[885] . "<br/><b class='b1'>";
        if ($avg_e_cost > $GAME_VARS['buy_elect']) {
            $out_str .= $st[886];
        } else {
            $out_str .= $st[887];
Example #9
0
function search_the_db2($orig_search, $all_any)
{
    global $db_name, $cw, $st;
    //initialise an array containing topic headings
    $topic_array = array('admin' => 0, 'attacking' => 0, 'bomb' => 0, 'clan' => 0, 'game_status' => 0, 'maint' => 0, 'other' => 0, 'player_status' => 0, 'planet' => 0, 'random_event' => 0, 'ship' => 0);
    //make sure doesn't contain nasties, or mysql REGEXP trip-ups
    $term = trim(mysql_escape_string(preg_replace("/(\\^|\\\$|\\.|\\*|\\+|\\?|\\||\\(|\\)|\\{|\\}|\\,|\\=|\\:)/", "", $orig_search)));
    $keywords = preg_split("/\\s/", $term);
    //create the sql query
    $sql_query = "";
    //clear query text
    //want to search for all of the relevent terms
    if ($all_any == 1) {
        $operator = " &&";
        $text_any_all = $cw['all'];
    } else {
        //searching for any terms.
        $operator = " ||";
        $text_any_all = $cw['any'];
    }
    //loop through keywords
    foreach ($keywords as $value) {
        //add to sql_query text.
        $sql_query .= "{$operator} headline REGEXP '{$value}'";
    }
    //get rid of leading operator, place surrounding brackets around it
    $sql_query = "(" . preg_replace("/^" . preg_quote($operator) . " /", "", $sql_query) . ") && ( ";
    //deal with the topics
    $counter = 0;
    $topic_sql_q = "";
    foreach ($topic_array as $key => $val) {
        if (!empty($_POST[$key])) {
            $topic_sql_q .= " || topic_set LIKE '{$key}'";
            $counter++;
        }
    }
    //make sure at least some topics were selected
    if ($counter == 0) {
        print_page($st[921], $st[922]);
    }
    //get rid of lead || and add a trailing bracket )
    $sql_query .= preg_replace("/^ \\|\\| /", "", $topic_sql_q) . ")";
    $t_str = "";
    $counter = 0;
    db("select timestamp, headline from {$db_name}_news where {$sql_query}");
    while ($results = dbr(1)) {
        $counter++;
        $t_str .= quick_row("<b>" . date("M d - H:i", $results['timestamp']), stripslashes($results['headline']));
    }
    $text = "<a href='{$_SERVER['PHP_SELF']}'>" . $st[923] . "</a><p /><b>{$counter}</b> " . sprintf($st[924], $orig_search, $text_any_all) . ".";
    //if there were results, print a nice page.
    if ($counter != 0) {
        $text .= "<p />" . make_table(array("", "")) . $t_str . "</table>";
    }
    print_page($st[920], news_search_bar() . $text);
}
Example #10
0
$text .= quick_row($cw['location'], $cw['sys'] . " # {$ship['location']}");
$text .= quick_row($cw['fleet'] . " #", $ship['fleet_id']);
$text .= quick_row("", "");
$text .= quick_row($cw['fighters'], "{$ship['fighters']}/{$ship['max_fighters']}");
$text .= quick_row($cw['shields'], "{$ship['shields']}/{$ship['max_shields']}");
$text .= quick_row($cw['armour'], "{$ship['armour']}/{$ship['max_armour']}");
$text .= quick_row($cw['size'], discern_size($ship['size']));
$text .= quick_row($cw['cargo_bays'], bay_storage($ship));
if ($GAME_VARS['alternate_play_1'] == 1) {
    $text .= quick_row($cw['mining_rate'] . ": " . $cw['metal'], $ship['mine_rate_metal']);
    $text .= quick_row($cw['mining_rate'] . ": " . $cw['fuel'], $ship['mine_rate_fuel']);
} else {
    $quick_maths = $ship['mine_rate_metal'] + $ship['mine_rate_fuel'];
    $text .= quick_row($cw['mining_rate'], $quick_maths);
}
$text .= quick_row($cw['speed_move_cost'], $ship['move_turn_cost']);
$text .= quick_row("", "");
$text .= quick_row($cw['upgrade_pods'], $ship['upgrade_slots']);
$text .= quick_row($cw['specials'], config_list(0, $ship['config']));
$text .= quick_row("# " . $cw['offensive_turrets'], $ship['num_ot']);
$text .= quick_row("# " . $cw['defensive_turrets'], $ship['num_dt']);
$text .= quick_row("# " . $cw['plasma_turrets'], $ship['num_pc']);
$text .= quick_row("# " . $cw['electronic_warfare_pods'], $ship['num_ew']);
$text .= quick_row("", "");
$text .= quick_row($cw['point_value'], $ship['point_value']);
$text .= quick_row($cw['points_killed'], $ship['points_killed']);
$text .= "</table>";
//$text = utf8_encode($text);
$rs = "";
//print_s_page($cw['ship_info'], $text);
echo "<div class='popup'>{$text}</div>";
Example #11
0
        echo "</table><br />";
    }
    db("select count(distinct clan_id),count(login_id) from {$db_name}_users where clan_id > 0 && login_id > 5");
    $ct5 = dbr();
    if (!empty($ct5[0])) {
        echo make_table(array($cw['clans'], "<b>{$ct5['0']}</b>"));
        echo quick_row($cw['membership'], $ct5[1]);
        echo "</table><br />";
    }
    echo "</td><td>";
    #echo "Top 10 Players<br />";
    echo make_table(array($cw['score'], $cw['login_name']));
    db("select login_name,clan_id,clan_sym,clan_sym_color,score from {$db_name}_users where ship_id > 1 and login_id > 5 order by score desc, login_name limit 10");
    $players = dbr();
    while ($players) {
        if ($players['clan_id'] == 0 || $players['clan_sym'] == "") {
            $players['login_name'] = "<b class='b1'>{$players['login_name']}</b>";
        } else {
            $players['login_name'] = "<b class='b1'>{$players['login_name']}</b>(<font color={$players['clan_sym_color']}>{$players['clan_sym']}</font>)";
        }
        echo quick_row("<b>{$players['score']}</b>", $players['login_name']);
        $players = dbr();
    }
    echo "</table><br />";
    echo "</td></tr><tr><td colspan=3>";
}
echo "</table>";
echo "</div>";
$html = ob_get_contents();
ob_clean();
echo $html;
Example #12
0
function bug_details($in_status)
{
    preg_match_all("/[0-9]/", $in_status, $ar_status);
    if ($ar_status[0][0] == 1) {
        $cent_txt = "Open";
        $end_txt = "Un-Assigned";
    } elseif ($ar_status[0][0] == 2) {
        $cent_txt = "Outstanding";
        if ($ar_status[0][1] == 1) {
            $end_txt = "Critical";
        } elseif ($ar_status[0][1] == 2) {
            $end_txt = "Major";
        } elseif ($ar_status[0][1] == 3) {
            $end_txt = "Minor";
        } elseif ($ar_status[0][1] == 4) {
            $end_txt = "Trivial";
        } elseif ($ar_status[0][1] == 5) {
            $end_txt = "Quickie";
        } else {
            $end_txt = "Un-Assigned";
        }
    } elseif ($ar_status[0][0] == 3) {
        $cent_txt = "Closed";
        if ($ar_status[0][1] == 1) {
            $end_txt = "Fixed";
        } elseif ($ar_status[0][1] == 2) {
            $end_txt = "Left Unfixed";
        } elseif ($ar_status[0][1] == 3) {
            $end_txt = "Duplicate";
        } elseif ($ar_status[0][1] == 4) {
            $end_txt = "Invalid";
        } elseif ($ar_status[0][1] == 5) {
            $end_txt = "Feature";
        } else {
            $end_txt = "Un-Assigned";
        }
    }
    return quick_row("Status", $cent_txt) . quick_row("Type", $end_txt);
}