Example #1
0
<?php

include "../spaceregentsinc/init.inc.php";
$ses->delete_session();
echo "<html><head>";
echo "<style type=\"text/css\">\n<!--h3,p,h1,h2,table,tr,td,th {color:white;} --></style>\n";
echo "</head>";
echo "<body bgcolor=\"black\" text=\"white\">";
center_headline("You are now logged out!");
echo "<br><br><br>\n";
echo "<center>\n";
echo "<embed src=\"outro.svg\" type=\"image/svg+xml\" width=\"600\" height=\"300\">\n";
echo "</center>\n";
echo "</body>";
echo "</html>";
?>


Example #2
0
function show_menu()
{
    global $PHP_SELF;
    global $skin;
    center_headline("Communications");
    table_start("center", "500");
    table_text_open("", "center");
    table_text_design("<a href=\"communication.php?act=show_alliance\"><img src=\"skins/" . $skin . "_alliance.jpg\" border=\"0\" width=\"50\" height=\"50\" alt=\"Alliance Menu\"></A>", "163", "center");
    table_text_design("<a href=\"database.php\"><img src=\"skins/" . $skin . "_database.jpg\" border=\"0\" width=\"50\" height=\"50\" alt=\"Galactic Database\"></A>", "163", "center");
    table_text_design("<a href=\"communication.php?act=show_journal\"><img src=\"skins/" . $skin . "_notebook.jpg\" border=\"0\" width=\"50\" height=\"50\" alt=\"Personal journal\"></A>", "163", "center");
    table_text_design("<a href=\"mail.php\"><img src=\"skins/" . $skin . "_mail.jpg\" border=\"0\" width=\"50\" height=\"50\" alt=\"Mailbox\"></A>", "164", "center");
    table_text_close();
    table_text_open("");
    table_text_design("Alliance Menu", "", "center");
    table_text_design("Galactic Database", "", "center");
    table_text_design("Journal", "", "center");
    table_text_design("Mailbox", "", "center");
    table_text_close();
    table_end();
    echo "<br><br>\n";
}
function show_foreign_forum()
{
    global $PHP_SELF;
    global $uid;
    if (has_alliance_lock($uid)) {
        show_message("You can't use any alliance options due to an alliance lock!");
        return false;
    }
    $sth = mysql_query("select a.id,a.name,u.name as u_name from users u left join alliance a on u.id = a.forminister where u.id =" . $uid);
    if (!$sth) {
        show_message("Database Failure");
        return false;
    }
    $alliance = mysql_fetch_array($sth);
    if ($alliance["name"] == null) {
        show_message("You are not a Foreign Minister! You can read but not write.");
    }
    $sth = mysql_query("select * from foreignforum where fid is NULL order by time DESC");
    if (!$sth) {
        show_message("Database Failure");
        return 0;
    }
    center_headline("Foreign Ministers Forum");
    if (mysql_num_rows($sth) == 0) {
        show_message("There are no entrys so far!");
    } else {
        table_start("center", "500");
        table_head_text(array("Messages"), "3");
        table_text(array("&nbsp;"), "", "", "3", "text");
        table_text(array("Topic", "Posted by", "Date"), "center", "", "", "head");
    }
    while ($topics = mysql_fetch_array($sth)) {
        $sth1 = mysql_query("select a.name as aname,u.name as uname from users as u,alliance as a where u.alliance=a.id and u.id=" . $topics["uid"]);
        if (!$sth1) {
            show_error("Database failure!");
            return 0;
        }
        $forumnames = mysql_fetch_array($sth1);
        table_text(array("<a href=\"" . $PHP_SELF . "?act=show_foreign_topic&id=" . $topics["id"] . "\">" . $topics["topic"] . "</A>", $forumnames["aname"] . " (" . $forumnames["uname"] . ")", $topics["time"]), "center", "", "", "text");
    }
    table_text(array("&nbsp;"), "", "", "3", "none");
    if ($alliance["name"] != null) {
        table_text(array("<a href=\"" . $PHP_SELF . "?act=new_topic&art=foreign\">New Topic</a>"), "left", "", "3", "none");
    }
    table_end();
}
Example #4
0
{
    table_start("center", "500");
    table_head_text(array("Battlereports"), "1");
    table_text(array("<a href=\"battlereport.php?act=show_own\">Battlereports</a>"), "", "", "", "text");
    table_text_open("head");
    table_text_close();
    table_end();
    echo "<br><br>";
}
$sth = mysql_query("select * from users where id={$uid}");
if (!$sth) {
    show_error("Datenbankfehler!");
    return 0;
}
$data = mysql_fetch_assoc($sth);
center_headline($data["name"] . " of " . $data["imperium"]);
//mails();
//fleet();
switch ($act) {
    case del:
        del();
        news();
        show_battlereports();
        show_research();
        planets();
        fleets();
        production();
        break;
    case delete_all:
        delete_all();
        news();
Example #5
0
function show_info()
{
    global $uid;
    global $pid;
    $sth = mysql_query("select * from planets p,popgain g where p.id={$pid} and p.uid={$uid} and p.id=g.pid");
    if (!$sth || mysql_num_rows($sth) == 0) {
        show_error("Jailhouse rock!");
        return 0;
    }
    center_headline("Information Screen");
    $planet = mysql_fetch_assoc($sth);
    table_border_start("center", "", "#302859", "#100666", "#D2CCF9");
    echo "<tr>\n";
    echo " <td rowspan=\"14\">\n";
    echo "   <img src=\"arts/" . $planet["type"] . ".jpg\">\n";
    echo " <td>\n";
    echo "</tr>\n";
    table_head_text(array("Information"), "2");
    table_text_open();
    table_text_design("Owner", "", "center", "1", "head");
    $sth = mysql_query("select u.name,ifnull(a.name,'none') as aname from users u left join alliance a on a.id=u.alliance where u.id=" . $planet["uid"]);
    if (!$sth || mysql_num_rows($sth) == 0) {
        show_error("Database failure!");
        return 0;
    }
    $owner = mysql_fetch_assoc($sth);
    table_text_design($owner["name"], "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("System", "", "center", "1", "head");
    table_text_design(get_systemname($planet["sid"]), "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("Alliance", "", "center", "1", "head");
    table_text_design($owner["aname"], "", "center", "1", "text");
    table_text_close();
    if ($planet["gain"] > 0) {
        $gain = "<span style=\"color: lime\">+" . $planet["gain"] * 100 . "%</span>";
    } else {
        $gain = "+/-0%";
    }
    table_text_open();
    table_text_design("Population", "", "center", "1", "head");
    table_text_design(get_poplevel_by_pop($planet["population"]) . " " . $gain . " (" . $planet["max_poplevel"] . ")", "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("Planettype", "", "center", "1", "head");
    switch ($planet["type"]) {
        case "O":
            $type = "Origin Class";
            break;
        case "M":
            $type = "Mars Class";
            break;
        case "A":
            $type = "Ancient Class";
            break;
        case "D":
            $type = "Desert Class";
            break;
        case "E":
            $type = "Eden Class";
            break;
        case "G":
            $type = "Gas Giant Class";
            break;
        case "H":
            $type = "Heavy Grav Class";
            break;
        case "I":
            $type = "Ice Class";
            break;
        case "R":
            $type = "Rock Class";
            break;
        case "T":
            $type = "Toxic Class";
            break;
    }
    define("planet_raw_metal", "8.5");
    define("planet_raw_energy", "8.5");
    define("planet_raw_mopgas", "8.5");
    define("planet_raw_erkunum", "8.5");
    define("planet_raw_gortium", "8.5");
    define("planet_raw_susebloom", "8.5");
    define("planet_no_upgrade_factor", "1");
    $sth = mysql_query("select * from planets where id={$pid}");
    $population_factor = log10($planet["population"] / 1000) + 3;
    $sth = mysql_query("select * from final_prod_factors where pid=" . $pid);
    if (!$sth) {
        show_error("ERR::GET PROD_FACTORS");
        return false;
    }
    if (mysql_num_rows($sth) == 1) {
        $factors = mysql_fetch_assoc($sth);
    } else {
        $factors = false;
    }
    $metal_plus = round($factors["metal"] * ($planet["metal"] / 100) * (planet_raw_metal * $population_factor));
    $energy_plus = round($factors["energy"] * ($planet["energy"] / 100) * planet_raw_energy * $population_factor);
    $mopgas_plus = round($factors["mopgas"] * ($planet["mopgas"] / 100) * planet_raw_mopgas * $population_factor);
    $erkunum_plus = round($factors["erkunum"] * ($planet["erkunum"] / 100) * planet_raw_erkunum * $population_factor);
    $gortium_plus = round($factors["gortium"] * ($planet["gortium"] / 100) * planet_raw_gortium * $population_factor);
    $susebloom_plus = round($factors["susebloom"] * ($planet["susebloom"] / 100) * planet_raw_susebloom * $population_factor);
    table_text_design($type, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("Production factor", "", "center", "1", "head");
    table_text_design($planet["production_factor"] * 100 . "%", "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/metal.gif' title='Metal' alt='Metal'>", "", "center", "1", "head");
    table_text_design($metal_plus, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/energy.gif' title='Energy' alt='Energy'>", "", "center", "1", "head");
    table_text_design($energy_plus, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/mopgas.gif' title='Mopgas' alt='Mopgas'>", "", "center", "1", "head");
    table_text_design($mopgas_plus, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/erkunum.gif' title='Erkunum' alt='Erkunum'>", "", "center", "1", "head");
    table_text_design($erkunum_plus, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/gortium.gif' title='Gortium' alt='Gortium'>", "", "center", "1", "head");
    table_text_design($gortium_plus, "", "center", "1", "text");
    table_text_close();
    table_text_open();
    table_text_design("<img src='arts/susebloom.gif' title='Susebloom' alt='Susebloom'>", "", "center", "1", "head");
    table_text_design($susebloom_plus, "", "center", "1", "text");
    table_text_close();
    table_end();
    echo "<br><br>\n";
    echo "<center>\n";
    //  echo("<a href=\"planet.php?pid=".$planet["id"]."\" target=\"anzeige_frame\">fleet orders</a>\n");
    echo "</center>\n";
    echo "<br>\n";
    $query = mysql_query("SELECT ps.*, p.pic, p.description, p.name FROM planetary_shields ps \nINNER JOIN production p USING (prod_id) WHERE pid={$pid}") or die(mysql_error());
    if (mysql_num_rows($query) > 0) {
        table_start("center", "500");
        table_head_text(array("Shield generators installed on {$planet['name']}"), "5");
        table_text_open("head");
        table_text_design("&nbsp;", "50px", "", "", "head");
        table_text_design("Building", "300", "", "", "head");
        table_text_design("Max", "50", "center", "", "head");
        table_text_design("Power", "50", "center", "", "head");
        table_text_design("Load", "50", "center", "", "head");
        while ($result = mysql_fetch_assoc($query)) {
            table_text_open("text", "center");
            table_text_design("<a href='" . $_SERVER["PHP_SELF"] . "?act=print_building_info&prod_id=" . $result["prod_id"] . "'><img src='arts/" . $result["pic"] . "' alt='" . $result["description"] . "' border='0' width=\"50px\" height=\"50px\" /></a>", "50px", "", "", "text", "2");
            table_text_design($result["name"], "300", "", "", "text", "2");
            table_text_design($result["max_value"], "50", "", "", "text", "2");
            table_text_design($result["value"], "50", "", "", "text", "2");
            table_text_design($result["regeneration"] + $result["regeneration_bonus"], "50", "", "", "text", "2");
            table_text_close();
        }
        table_end();
    }
    echo "<br>\n";
    table_start("center", "500");
    table_head_text(array("Units stationed on " . $planet["name"]), "5");
    table_text(array("&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;", "&nbsp;"), "center", "100", "", "text");
    table_text_open("head");
    table_text_design("Infantry", "200", "center", "2", "head");
    table_text_design("&nbsp;", "100", "", "", "head");
    table_text_design("Fleet", "200", "center", "2", "head");
    table_text_close();
    $sth = mysql_query("select sum(count) from infantery as i,production as p where i.pid=" . $pid . " and i.prod_id=p.prod_id\n      and p.typ='I'");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    $inf = mysql_fetch_row($sth);
    if ($inf[0] == "") {
        $inf[0] = "No troops";
    }
    table_text_open("text", "center");
    table_text_design("Infantry", "", "", "", "text");
    table_text_design($inf[0], "", "", "", "text");
    table_text_design("&nbsp;", "100", "", "", "none");
    table_text_design("Europa Class", "", "", "", "text");
    table_text_design(get_fcount_by_type($uid, "L", $pid), "", "", "", "text");
    table_text_close();
    $sth = mysql_query("select sum(count) from infantery as i,production as p where i.pid=" . $pid . " and i.prod_id=p.prod_id and p.typ='T'");
    if (!$sth) {
        show_error("Database failure!");
        return 0;
    }
    $inf = mysql_fetch_row($sth);
    if ($inf[0] == "") {
        $inf[0] = "No Vehicles";
    }
    table_text_open("text", "center");
    table_text_design("Vehicles", "", "", "", "text");
    table_text_design($inf[0], "", "", "", "text");
    table_text_design("&nbsp;", "100", "", "", "none");
    table_text_design("Zeus Class", "", "", "", "text");
    table_text_design(get_fcount_by_type($uid, "M", $pid), "", "", "", "text");
    table_text_close();
    table_text_open("text", "center");
    table_text_design("&nbsp;");
    table_text_design("&nbsp;");
    table_text_design("&nbsp;", "100", "", "", "none");
    table_text_design("Olymp Class", "", "", "", "text");
    table_text_design(get_fcount_by_type($uid, "H", $pid), "", "", "", "text");
    table_text_close();
    table_end();
}
Example #6
0
function show_available_fleets()
{
    global $uid;
    global $pid;
    global $bewohnbar;
    global $PHP_SELF;
    table_start("center", "500");
    table_text(array("<a href=\"" . $PHP_SELF . "?act=show_fleets&pid=" . $pid . "&bewohnbar=" . $bewohnbar . "\">Show your own fleets</a>", "<a href=\"" . $PHP_SELF . "?act=show_available_fleets&pid=" . $pid . "&bewohnbar=" . $bewohnbar . "\">Show fleets assigned to you</a>"));
    table_end();
    $sth = mysql_query("select a.milminister,a.id,u.alliance from alliance as a, users as u where a.milminister='{$uid}' and u.alliance = a.id");
    if (!$sth) {
        show_message("Database Failure 1");
        return 0;
    }
    if ($sth == 0) {
        show_message("Not working! Fool >:o");
        return 0;
    }
    $sth = mysql_query("select f.*,p.typ,p.special from fleet as f,production as p where f.milminister='{$uid}' and p.prod_id=f.prod_id order by f.fid");
    if (!$sth) {
        show_error("Database failure! 2");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        center_headline("No allied fleets under your command");
        return 0;
    }
    table_start("center", "80%");
    table_head_text(array("Allied Fleets under your command"), "9");
    table_text(array("&nbsp;"), "", "", "9", "text");
    table_text(array("Fleet number", "Light Ships", "Medium Ships", "Heavy Ships", "Current Mission", "New Mission", "Behaviour", "ETA", "&nbsp;"), "center", "", "", "head");
    while ($part_fleet = mysql_fetch_array($sth)) {
        if ($part_fleet["fid"] != $fid_old) {
            $fid_old = $part_fleet["fid"];
            $counter++;
        }
        $fleet[$counter][] = $part_fleet;
    }
    for ($i = 1; $i <= sizeof($fleet); $i++) {
        $light = "";
        $medium = "";
        $heavy = "";
        for ($j = 0; $j < sizeof($fleet[$i]); $j++) {
            if ($fleet[$i][$j]["typ"] == "L") {
                $light += $fleet[$i][$j]["count"];
            }
            if ($fleet[$i][$j]["typ"] == "M") {
                $medium += $fleet[$i][$j]["count"];
            }
            if ($fleet[$i][$j]["typ"] == "H") {
                $heavy += $fleet[$i][$j]["count"];
            }
            if ($fleet[$i][$j]["special"] == "O") {
                $fleet[$i][0]["orbital_colony"] = "O";
            }
        }
        switch ($fleet[$i][0]["mission"]) {
            case "0":
                $mission_text["a"] = "Defending";
                $mission_text["b"] = "defend";
                break;
            case "1":
                $mission_text["a"] = "Attacking";
                $mission_text["b"] = "attack";
                break;
            case "4":
                $mission_text["a"] = "Colonizing";
                $mission_text["b"] = "colonize";
                break;
            case "5":
                $mission_text["a"] = "Invading";
                $mission_text["b"] = "invade";
        }
        if ($fleet[$i][0]["pid"] != 0 and $fleet[$i][0]["tsid"] == 0 and $fleet[$i][0]["tpid"] == 0) {
            $planetname = get_planetname($fleet[$i][0]["pid"]);
            $mission = $mission_text["a"] . " planet " . $planetname;
        }
        if ($fleet[$i][0]["pid"] == 0 and $fleet[$i][0]["tsid"] == 0 and $fleet[$i][0]["tpid"] == 0) {
            $systemname = get_systemname($fleet[$i][0]["sid"]);
            $mission = $mission_text["a"] . " system " . $systemname;
        }
        if ($fleet[$i][0]["tsid"] != 0 and $fleet[$i][0]["tpid"] == 0) {
            $systemname = get_systemname($fleet[$i][0]["tsid"]);
            $mission = "On its way to " . $mission_text["b"] . " system " . $systemname;
        }
        if ($fleet[$i][0]["tsid"] != 0 and $fleet[$i][0]["tpid"] != 0) {
            $planetname = get_planetname($fleet[$i][0]["tpid"]);
            $mission = "On its way to " . $mission_text["b"] . " planet " . $planetname;
        }
        $sth = mysql_query("select x,y,id from systems where id=" . $fleet[$i][0]["sid"]);
        $system = mysql_fetch_array($sth);
        $sth = mysql_query("select s.x,s.y,s.id from systems as s,planets as p where s.id=p.sid and p.id={$pid}");
        $targetsystem = mysql_fetch_array($sth);
        if ($targetsystem["id"] == $system["id"]) {
            $eta = "Already here!";
        } else {
            $sth1 = mysql_query("select max(w.range) from warp as w,research as r where w.tid=r.t_id and r.uid=" . $uid);
            $range = mysql_fetch_row($sth1);
            if ($range[0] == NULL) {
                global $no_warp_tech;
                $range[0] = $no_warp_tech;
            }
            $eta = eta_to_planet($system["x"], $system["y"], $targetsystem["x"], $targetsystem["y"], $range[0], $old);
            if (!$eta) {
                $eta = "No route to system";
            } else {
                $eta = $eta[0];
            }
        }
        $sth = mysql_query("select uid from planets where id={$pid} and uid!=0 and uid!={$uid}");
        if (mysql_num_rows($sth) != 0) {
            $invade = "<option value=\"5\"> Invade Planet";
        }
        if ($fleet[$i][0]["pid"] == $pid) {
            $sth = mysql_query("select f.fid from inf_transporters as i,fleet as f where i.prod_id=f.prod_id and f.fid=" . $fleet[$i][0]["fid"]);
            if (mysql_num_rows($sth) != 0) {
                $transport = "<option value=\"9\"> Transfer Infantery";
            }
        }
        $new_mission = "<select name=\"newmission\">\n";
        $new_mission = $new_mission . "<option value=\"0\">Defend this planet<option value=\"1\">Attack this planet" . $transport . $invade . "</select>";
        $behaviour = "<select name=\"behaviour\">\n";
        if ($fleet[$i][0]["behaviour"] == 0) {
            $behaviour = $behaviour . "<option selected value=\"0\">Evasive";
            $behaviour = $behaviour . "<option value=\"1\">Aggressive";
        } else {
            $behaviour = $behaviour . "<option value=\"0\">Evasive";
            $behaviour = $behaviour . "<option selected value=\"1\">Aggressive";
        }
        $behaviour = $behaviour . "</select>";
        if ($light == "") {
            $light = "0";
        }
        if ($medium == "") {
            $medium = "0";
        }
        if ($heavy == "") {
            $heavy = "0";
        }
        echo "<form action=\"" . $PHP_SELF . "\" method=post>";
        table_text(array(($k += 1) . "<input type=hidden name=\"fid\" value=\"" . $fleet[$i][0]["fid"] . "\"", $light, $medium, $heavy, $mission, $new_mission, $behaviour, $eta, "<input type=hidden name=\"act\" value=\"newmission\"><input type=hidden name=\"pid\" value=\"" . $pid . "\"><input type=submit value=\"Execute\""), "center", "", "", "text");
        echo "</form>";
    }
    table_end();
}
Example #7
0
function admiral_pool()
{
    global $uid;
    $sth = mysql_query("select * from admirals where uid={$uid} and fid=0");
    if (!$sth) {
        show_error("Database error!");
        return 0;
    }
    if (mysql_num_rows($sth) == 0) {
        return 0;
    }
    center_headline("Admiral Pool");
    table_start("center", "500");
    table_head_text(array("Admirals"), "7");
    table_text(array("&nbsp;"), "", "", "7", "text");
    table_text_open();
    table_text_design("&nbsp;", "50", "", "", "head");
    table_text_design("Name", "200", "", "", "head");
    table_text_design("Rank", "75", "", "", "head");
    table_text_design("Initiative", "75", "", "", "head");
    table_text_design("Agility", "75", "", "", "head");
    table_text_design("Sensor", "75", "", "", "head");
    table_text_design("Weaponskill", "75", "", "", "head");
    table_text_close();
    while ($admiral = mysql_fetch_array($sth)) {
        if ($admiral["value"] < 1000) {
            $level = 0;
        } else {
            $level = floor(log10($admiral["value"] / 1000) / log10(2) + 1);
        }
        table_text_open();
        table_text_design("<img src=\"portraits/" . $admiral["pic"] . "\" border=\"0\" alt=\"" . $admiral["name"] . "\">", $admiral["name"], "200", "center", "", "text");
        table_text_design($admiral["name"], "75", "center", "", "text");
        table_text_design($level, "75", "center", "", "text");
        foreach (array("initiative", "agility", "sensor", "weaponskill") as $dummy => $value) {
            if (calculate_admiral_level($admiral["used_xp"]) < $level) {
                $upgrade = "<a href=\"" . $PHP_SELF . "?act=upgrade_admiral_pool&id=" . $admiral["id"] . "&value=" . $value . "\"><img src=\"arts/plus.jpg\" border=\"0\" width=\"10\"></a>";
            } else {
                $upgrade = "";
            }
            table_text_design($upgrade . $admiral[$value], "75", "center", "", "text");
        }
        table_text_close();
    }
    table_end();
}