function print_table_start($title = "", $col = "", $width = 100) { table_start("center", "100%"); table_head_text(array($title)); table_end(); table_start("center", "100%"); }
function overview() { global $uid; $sth = mysql_query("select b.prod_id,b.count,b.side,p.name,p.typ,b.initiative,b.agility,b.hull,b.weaponpower,b.shield,b.ecm,b.target1,b.sensor,b.weaponskill,b.special,b.armor,b.num_attacks,s.initiative,s.agility,s.hull,s.weaponpower,s.shield,s.ecm,s.target1,s.sensor,s.weaponskill,s.special,s.armor,s.num_attacks from battle_" . $uid . " b, production p, shipvalues s where b.prod_id=p.prod_id and b.prod_id=s.prod_id order by side"); echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"POST\">"; table_start("center", "700"); table_head_text(array("Battlesimulator"), 20); if (!$sth || mysql_num_rows($sth) == 0) { table_text(array("No ships"), "", "", "", "text"); } else { table_head_text(array("Side", "Name", "Type", "count", "initiative", "agility", "hull", "power", "shield", "ecm", "target1", "sensors", "skill", "special", "armor", "num_attacks", "mail")); while (list($prod_id, $count, $side, $name, $typ, $cur_ini, $cur_agi, $cur_hull, $cur_pow, $cur_shield, $cur_ecm, $cur_tar1, $cur_sen, $cur_skill, $cur_spec, $cur_arm, $cur_num, $ini, $agi, $hull, $pow, $shield, $ecm, $tar1, $sen, $skill, $spec, $arm, $num) = mysql_fetch_row($sth)) { table_text(array($side, $name, $typ, "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][count]\" size=\"4\" value=\"" . $count . "\">", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][initiative]\" size=\"3\" value=\"" . $cur_ini . "\"> (" . $ini . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][agility]\" size=\"3\" value=\"" . $cur_agi . "\"> (" . $agi . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][hull]\" size=\"3\" value=\"" . $cur_hull . "\"> (" . $hull . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][weaponpower]\" size=\"3\" value=\"" . $cur_pow . "\"> (" . $pow . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][shield]\" size=\"3\" value=\"" . $cur_shield . "\"> (" . $shield . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][ecm]\" size=\"3\" value=\"" . $cur_ecm . "\"> (" . $ecm . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][target1]\" size=\"3\" value=\"" . $cur_tar1 . "\"> (" . $tar1 . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][sensor]\" size=\"3\" value=\"" . $cur_sen . "\"> (" . $sen . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][weaponskill]\" size=\"3\" value=\"" . $cur_skill . "\"> (" . $skill . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][special]\" size=\"3\" value=\"" . $cur_spec . "\"> (" . $spec . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][armor]\" size=\"3\" value=\"" . $cur_arm . "\"> (" . $arm . ")", "<input type=\"text\" name=\"battle[" . $side . "][" . $prod_id . "][num_attacks]\" size=\"3\" value=\"" . $cur_num . "\"> (" . $num . ")", "<a href=\"" . $_SERVER["PHP_SELF"] . "?act=suggest&side=" . $side . "&prod_id=" . $prod_id . "\">suggest change</a>"), "", "", "", "text"); } } table_form_submit("Change", "proc_change_values"); table_end(); echo "</form>"; $sth = mysql_query("select prod_id,name from production where typ in ('L','M','H','I') \norder by name"); if (!$sth) { show_error("database failersdfiosd"); return false; } echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"POST\">"; table_start("center", "500"); table_head_text(array("Add ships"), "2"); while (list($prod_id, $name) = mysql_fetch_row($sth)) { $select[$name] = $prod_id; } table_form_select("Ship", "prod_id", $select, "2", "text", "text"); table_form_select("Side", "side", array(1 => 1, 2 => 2), "2", "text", "text"); table_form_text("Count", "count"); table_form_submit("Add ships", "proc_add_ships"); table_end(); echo "</form>"; echo "<br>"; echo "<form action=\"" . $_SERVER["PHP_SELF"] . "\" method=\"POST\">"; table_start("center", "500"); table_head_text(array("Config"), "2"); table_form_select("Combat rounds", "rounds", array(1 => 1, 2 => 2, 3 => 3, 4 => 4, 5 => 5, 10 => 10), "1", "text", "text"); table_form_select("Fraction limit", "fraction", array(100 => 100, 250 => 250, 500 => 500, 1000 => 1000, 2000 => 2000, "no limit" => 0), "250", "text", "text"); table_form_select("Orbital Dig-In factor (Side 1)", "digino", array("no dig-in" => 0, 20 => 20, 40 => 40, 60 => 60, 65 => 65, 70 => 70, 75 => 75, 80 => 80, 85 => 85, 90 => 90, 95 => 95, 99 => 99), "0", "text", "text"); table_form_select("Orbital Dig-In bonus (Side 1)", "diginob", array("no bonus" => 0, 5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 55 => 55), "0", "text", "text"); table_form_select("Planetary Dig-In factor (Side 1)", "diginp", array("no dig-in" => 0, 20 => 20, 40 => 40, 60 => 60, 65 => 65, 70 => 70, 75 => 75, 80 => 80, 85 => 85, 90 => 90, 95 => 95, 99 => 99), "70", "text", "text"); table_form_select("Planetary Dig-In bonus (Side 1)", "diginpb", array("no bonus" => 0, 5 => 5, 10 => 10, 15 => 15, 20 => 20, 25 => 25, 30 => 30, 35 => 35, 40 => 40, 45 => 45, 50 => 50, 55 => 55), "20", "text", "text"); table_form_select("Overall combat boost", "boost", array("no boost" => 1, 2 => 2, 3 => 3, 5 => 5), "1", "text", "text"); table_form_select("Verbosity", "verbosity", array("Results only" => 0, "Overview" => 1, "Full details" => 2), "1", "text", "text"); table_form_submit("Execute battle", "execute_battle"); table_end(); echo "</form>"; //print "<a href=\"".$_SERVER["PHP_SELF"]."?act=execute_battle\">Execute battle</a>"; }
function show_messages() { global $PHP_SELF; global $uid; global $name; global $text; global $subject; $sth = mysql_query("update users set last_login='******' where id={$uid}"); $sth = mysql_query("select * from mail where uid='{$uid}' order by time desc"); if (!$sth) { show_error("Database Failure!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("No Mail!"); echo "<br><br>\n"; } while ($mail = mysql_fetch_array($sth)) { if ($mail["fuid"] == 0) { $user["name"] = "Spaceregent"; $user["Imperium"] = "Spaceregents Universe"; } else { $sth1 = mysql_query("select name,imperium from users where id='" . $mail["fuid"] . "'"); $user = mysql_fetch_array($sth1); } table_start("center", "500"); table_text_open(); table_text_design("<strong>" . $mail["subject"] . "</strong> from <strong>" . $user["imperium"] . " (" . $user["name"] . ")</strong> [ " . $mail["time"] . " ]", "500", "", "", "head"); table_text_close(); table_text(array(nl2br($mail["text"])), "left", "", "", "text"); table_raw_text("<a href=\"" . $PHP_SELF . "?act=reply&id=" . $mail["id"] . "\">Reply</A> <a href=\"" . $PHP_SELF . "?act=delete&mid=" . $mail["id"] . "\">Delete</A>"); table_end(); } echo "<a href=\"" . $PHP_SELF . "?act=delete\"><h3 align=\"center\">Delete all mails</h3></A>"; echo "<a name=\"mailform\">\n<form action=\"" . $PHP_SELF . "\" method=post>\n</a>\n"; table_border_start("center", "500", "#302859"); table_head_text(array("Send a new message"), "4"); table_form_text("Send to", "name", $name); table_form_text("Subject", "subject", stripslashes($subject), 40, 255); table_form_textarea("Message", "text", stripslashes($text)); table_form_submit("Send message", "send"); echo "</form>"; table_end(); }
function show_preferences() { global $uid; global $skin; global $PHP_SELF; $sth = mysql_query("select * from skins"); while ($skins = mysql_fetch_array($sth)) { $options[$skins["name"]] = $skins["id"]; } $sth = mysql_query("select admin from users where id={$uid}"); if (!$sth) { show_error("Database failuer!"); return 0; } $admin = mysql_fetch_array($sth); if ($admin["admin"] != "") { show_message("<a href='adminarea.php'>Enter Admin Area</a>"); } $map_info = new map_info($uid); if ($map_info->has_map_anims() == 1) { $checked = "checked"; } echo "<form method=POST action=\"" . $PHP_SELF . "\">"; table_start("center", "400"); table_head_text(array("Appearence"), "2"); table_text(array(" "), "", "", "2", "head"); table_form_select("Skin", "skin_new", $options, $skin, "head", "text"); table_form_submit("Change", "change_skin", "", "text"); table_end(); echo "</form>\n"; //runelord: map_sizes $sth = mysql_query("select map_size from options where uid=" . $uid); if (!$sth || !mysql_num_rows($sth)) { show_error("oops, DB Failure"); return 0; } list($current_map_size) = mysql_fetch_row($sth); $map_sizes_output = "<select name=\"map_size\" size=\"1\">"; $sth = mysql_query("SELECT * FROM map_sizes ORDER BY width ASC"); if (!$sth || !mysql_num_rows($sth)) { show_error("Database Failureeeeerrerererererere"); return 0; } while ($map_sizes = mysql_fetch_array($sth)) { if ($current_map_size == $map_sizes["id"]) { $map_sizes_output .= "<option selected value=\"" . $map_sizes["id"] . "\">" . $map_sizes["width"] . " : " . $map_sizes["height"] . "</option>"; } else { $map_sizes_output .= "<option value=\"" . $map_sizes["id"] . "\">" . $map_sizes["width"] . " : " . $map_sizes["height"] . "</option>"; } } $map_sizes_output .= "</select>"; echo "<form method=POST action=\"" . $PHP_SELF . "\">"; table_start("center", "400"); table_head_text(array("Map Settings"), "2"); table_text(array(" "), "", "", "2", "head"); table_text(array("Map Size"), "", "", "2", "head"); table_text(array($map_sizes_output), "", "", "2", "text"); table_form_submit("Change", "change_map_size", "", "text"); echo "</form>\n"; echo "<form method=POST action=\"" . $PHP_SELF . "\">"; table_text(array(" "), "", "", "2", "head"); table_text(array("Animations (KSVG needs disabled animations)", "<input type=\"checkbox\" name=\"animations\" value=\"1\" {$checked}>"), "", "", "", "head"); table_form_submit("Change", "change_anims", "", "text"); table_end(); echo "</form>\n"; table_start("center", "400"); echo "<form method=POST action=\"" . $PHP_SELF . "\">"; table_text(array("Change Password", " "), "", "", "", "head"); table_text_open(); table_text_design("Old Password", "300", "left", "", "text"); table_text_design("<input type=\"password\" align=\"right\" name=\"old\">", "100", "right", "", "text"); table_text_close(); table_text_open(); table_text_design("New Password", "300", "left", "", "text"); table_text_design("<input type=\"password\" align=\"right\" name=\"new1\">", "100", "right", "", "text"); table_text_close(); table_text_open(); table_text_design("Re-type new Password", "300", "left", "", "text"); table_text_design("<input type=\"password\" align=\"right\" name=\"new2\">", "100", "right", "", "text"); table_text_close(); table_form_submit("Set", "change_pw", "", "text"); table_end(); echo "</form>"; }
function show_diplomacy() { global $uid; global $start; global $PHP_SELF; if (has_alliance_lock($uid)) { show_message("You can't use any alliance options due to an alliance lock!"); return false; } $aid = get_alliance($uid); $is_leader = is_leader($uid, $aid); $sth = mysql_query("select a.name, d.alliance2, d.status, if(status = 0, 0,(if(status=1, 2, 1))) as my_order from diplomacy d, alliance a where d.alliance1='" . $aid . "' and a.id = d.alliance2 order by my_order, a.name"); if (!$sth) { echo "ERR::DIPLOMACY, could not get relationships"; return false; } table_start("center", "500"); table_head_text(array("Galactic diplomacy status"), 2); table_text_open("head", "center"); table_text_design(" ", "27", "left", "", "head"); table_text_design(" ", "", "left", "", "head"); table_text_close(); if (mysql_num_rows($sth) > 0) { while ($diplomacy = mysql_fetch_assoc($sth)) { if ($diplomacy["status"] == 0) { $dip_image = "arts/alliance_enemy.gif"; $alt = "Enemy"; } elseif ($diplomacy["status"] == 2) { $dip_image = "arts/alliance_friend.gif"; $alt = "Enemy"; } else { $dip_image = false; $alt = false; } table_text_open("head", "center"); table_text_design("<img src=\"" . $dip_image . "\" width=\"25\" height=\"25\" alt=\"" . $alt . "\" border=\"0\" />", "27", "center", "", "text"); table_text_design("<a href=\"database.php?act=info_alliance&aid=" . $diplomacy["alliance2"] . "\">" . $diplomacy["name"] . "</a>", "", "left", "", "text"); table_text_close(); } } else { table_text(array("no relations to other alliances"), "center", "", "2", "text"); } table_end(); //***********************+ $alliances = get_alliances($aid, true); table_start("center", "500"); table_head_text(array("Status"), 2); table_text(array(" "), "", "", 2, "head"); if (sizeof($alliances) == 0) { table_text(array("No alliances so far"), "", "", 2, "text"); } else { for ($i = 0; $i < sizeof($alliances); $i++) { table_text(array(get_alliance_name($alliances[$i]), get_diplomatic_status_text(get_diplomatic_status($aid, $alliances[$i]))), "", "", "", "text"); if (is_leader($uid, $aid)) { $pending_status = get_pending_diplomacy_change($aid, $alliances[$i]); $f_pending_status = get_pending_diplomacy_change($alliances[$i], $aid); if ($pending_status) { table_text(array(" ", get_diplomatic_status_text($pending_status) . " status pending <a href=\"" . $PHP_SELF . "?act=drop_pending&aid2=" . $alliances[$i] . "&aid1=" . $aid . "\">Drop</a>"), "", "", "", "head"); } elseif ($f_pending_status) { table_text(array(" ", get_diplomatic_status_text($f_pending_status) . " status awaiting your approval <a href=\"" . $PHP_SELF . "?act=drop_pending&aid1=" . $alliances[$i] . "&aid2=" . $aid . "\">Drop</a> <a href=\"" . $PHP_SELF . "?act=accept_pending&faid=" . $alliances[$i] . "\">Accept</a>"), "", "", "", "head"); } else { table_text(array(" ", "<a href=\"" . $PHP_SELF . "?act=change_diplomacy&faid=" . $alliances[$i] . "&new_status=0\" onclick=\"javascript:return confirm('Are you sure you want to declare war?');\">Change to <span style=\"color: #FF0000\">Enemy</span></a> | <a href=\"" . $PHP_SELF . "?act=change_diplomacy&faid=" . $alliances[$i] . "&new_status=1\">Change to <span style=\"color: #FFFF00\">Neutral</span></a> | <a href=\"" . $PHP_SELF . "?act=change_diplomacy&faid=" . $alliances[$i] . "&new_status=2\">Change to <span style=\"color: #00FF00\">Friend</span></a>"), "", "", "", "head"); } } } } table_text(array(" "), "", "", 2, "head"); table_end(); }
function building_edit() { global $uid; global $id; global $PHP_SELF; $sth = mysql_query("select admin,name from users where id={$uid}"); if (!$sth) { show_message("Databse Failure"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("Forbidden"); return 0; } $admin = mysql_fetch_array($sth); if ($admin["admin"] == "") { show_message("Forbidden"); return 0; } else { if ($id == 'new') { echo "<a href=\"" . $PHP_SELF . "?act=buildings&order=name\">back</a>"; $sth = mysql_query("insert into production (typ,tech,name,description) values ('P','999','new','no description')"); if (!$sth) { show_message("Databse Failure : creating new building step 1"); return 0; } /* $sth=mysql_query("select prod_id from production where tech=999 and name='new' and description='no description' and typ='P'"); if (!$sth) { show_message("Databse Failure : creating new building step 2"); return 0; } $newid = mysql_fetch_array($sth); $sth=mysql_query("insert into shipvalues (prod_id,special) values ('".$newid["prod_id"]."','NULL')"); if (!$sth) { show_message("Databse Failure : creating new ship step 3"); return 0; } */ show_message("Empty Buildingslot created, plz edit at least Description,tech or name before creaating a new ship or ERRORS may accure!"); } else { $sth = mysql_query("select * from production where prod_id='{$id}'"); if (!$sth) { show_message("Databse Failure"); return 0; } $building = mysql_fetch_array($sth); $sth = mysql_query("select name,t_id from tech"); if (!$sth) { show_message("Databse Failuret"); return 0; } $sth1 = mysql_query("select name, prod_id from production where not (prod_id='{$id}')"); if (!$sth1) { show_message("Databse Failurep"); return 0; } echo "<a href=\"" . $PHP_SELF . "?act=buildings&order=name\">back</a>"; table_start("center", "500"); table_head_text(array("Editing building " . $building["name"]), "3"); table_text(array(" "), "", "", "3", "text"); table_text(array("variable", "old", "new"), "", "", "", "head"); echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=name&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Name", $building["name"], "<input type=\"Text\" name=\"new\" value=\"" . $building["name"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=prod_id&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Id", $building["prod_id"], "<input type=\"Text\" name=\"new\" value=\"" . $building["prod_id"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=typ&tid=" . $building["prod_id"] . "\" method=post>"; table_text_open(); table_text_design("Type", "", "", "", "text"); table_text_design($building["typ"], "", "", "", "text"); table_text_design("<select name=\"new\"> \n <option value=\"P\" selected>P \n <option value=\"O\">O \n </select><input type=\"Submit\" name=\"f1\" value=\"set\">\n</form>\n", "", "", "", "text"); table_text_close(); echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=com_time&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Time", $building["com_time"], "<input type=\"Text\" name=\"new\" value=\"" . $building["com_time"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=tech&tid=" . $building["prod_id"] . "\" method=post>"; table_text_open(); table_text_design("Tech", "", "", "text"); table_text_design($building["tech"], "", "", "text"); echo "<td><select name=\"new\">"; while ($techs = mysql_fetch_array($sth)) { if ($techs["t_id"] == $building["tech"]) { echo "<option value=\"" . $techs[t_id] . "\" selected>" . $techs["name"] . "\n"; } else { echo "<option value=\"" . $techs[t_id] . "\">" . $techs["name"] . "\n"; } } echo "</select><input type=\"Submit\" name=\"f1\" value=\"set\">\n</td>\n</form>\n"; table_text_close(); echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=p_depend&tid=" . $building["prod_id"] . "\" method=post>"; table_text_open(); table_text_design("Production_depend", "", "", "text"); table_text_design($building["p_depend"], "", "", "text"); echo "<td><select name=\"new\">"; while ($productions = mysql_fetch_array($sth1)) { if ($productions["prod_id"] == $building["p_depend"]) { echo "<option value=\"" . $productions[prod_id] . "\" selected>" . $productions["name"] . "\n"; } else { echo "<option value=\"" . $productions[prod_id] . "\">" . $productions["name"] . "\n"; } } echo "</select><input type=\"Submit\" name=\"f1\" value=\"set\">\n</td>\n</form>\n"; table_text_close(); echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=special&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Special", $building["special"], "<input type=\"Text\" name=\"new\" value=\"" . $building["special"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=metal&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Metal", $building["metal"], "<input type=\"Text\" name=\"new\" value=\"" . $building["metal"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=energy&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Energy", $building["energy"], "<input type=\"Text\" name=\"new\" value=\"" . $building["energy"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=mopgas&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Mopgas", $building["mopgas"], "<input type=\"Text\" name=\"new\" value=\"" . $building["mopgas"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=erkunum&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Erkunum", $building["erkunum"], "<input type=\"Text\" name=\"new\" value=\"" . $building["erkunum"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=gortium&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Gortium", $building["gortium"], "<input type=\"Text\" name=\"new\" value=\"" . $building["gortium"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=susebloom&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Susebloom", $building["susebloom"], "<input type=\"Text\" name=\"new\" value=\"" . $building["susebloom"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=edit&table=production&var=description&tid=" . $building["prod_id"] . "\" method=post>"; table_text(array("Description", $building["description"], "<input type=\"Text\" name=\"new\" value=\"" . $building["description"] . "\"><input type=\"Submit\" name=\"f1\" value=\"set\">"), "", "", "", "text"); echo "</form>\n"; echo "<form action=\"" . $PHP_SELF . "?act=del_building&id=" . $building["prod_id"] . "\" method=post>"; echo "<input type=\"Submit\" name=\"f1\" value=\"Delete building - all active buildings of this type will be deleted too\" disabled>"; echo "</form>\n"; table_end(); } } }
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(" "), "", "", "9", "text"); table_text(array("Fleet number", "Light Ships", "Medium Ships", "Heavy Ships", "Current Mission", "New Mission", "Behaviour", "ETA", " "), "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(); }
if (!$sth) { show_error("Database failure!"); return 0; } echo "<div id=\"menu\">"; print "<div id=\"buddy\" class=\"buddy\">\n"; include "buddy.php"; print "</div>\n"; include "menu_frame.php"; echo "</div>"; print "<div id=\"content\" class=\"content\">\n"; print "<!--[if IE]><div id=\"content2\"><![endif]-->\n"; /* print "<table width=\"100%\"><tr><td>"; print "<table border=\"1\" width=\"100%\" height=\"100%\"><tr><td style=\"vertical-align: top\">"; print "</td></tr>"; print "<tr style=\"height: 100%\"><td>saufen </td></tr>"; print "<tr><td>"; print "</td></tr></table></td><td>"; */ $ad = mysql_fetch_array($sth); table_start("center"); //table_text(array("<a href=\"ad.php?id=".$ad["id"]."\" target=\"_blank\"><img src=\"".$ad["image"]."\"></a>")); table_text(array("<a href=\"http://www.spaceregents.de/\" target=\"_blank\"><img src=\"http://www.spaceregents.de/banners/sr_banner.jpg\" border=\"0\" alt=\"spaceregents\" width=\"468\" height=\"60\" /></a>")); //table_text(array(" ")); table_end(); //show_bug_tracking(); table_start("center"); table_head_text(array("<a href=\"manual/metal_help.html\" target=\"_blank\"><img src=\"arts/metal.gif\" title=\"Metal\" alt=\"Metal\" border=\"0\"></a>", "<a href=\"manual/energy_help.html\" target=\"_blank\"><img src=\"arts/energy.gif\" title=\"Energy\" alt=\"Energy\" border=\"0\"></a>", "<a href=\"manual/mopgas_help.html\" target=\"_blank\"><img src=\"arts/mopgas.gif\" title=\"MopGas\" alt=\"MopGas\" border=\"0\"></a>", "<a href=\"manual/erkunum_help.html\" target=\"_blank\"><img src=\"arts/erkunum.gif\" title=\"Erkunum\" alt=\"Erkunum\" border=\"0\"></a>", "<a href=\"manual/gortium_help.html\" target=\"_blank\"><img src=\"arts/gortium.gif\" title=\"Gortium\" alt=\"Gortium\" border=\"0\"></a>", "<a href=\"manual/susebloom_help.html\" target=\"_blank\"><img src=\"arts/susebloom.gif\" title=\"Susebloom\" alt=\"Susebloom\" border=\"0\"></a>", "<a href=\"manual/money_help.html\" target=\"_blank\"><span style=\"color: yellow\">€</span></a>", "<a href=\"manual/colonists_help.html\" target=\"_blank\"><img src=\"arts/colonists.png\" border=\"0\"></span></a>", "Date")); print "<tr style=\"padding-left: 10; padding-right: 10\">\n<td align=\"center\" class=\"text\">{metal}</td>\n<td align=\"center\" class=\"text\">{energy}</td>\n<td align=\"center\" class=\"text\">{mopgas}</td>\n<td align=\"center\" class=\"text\">{erkunum}</td>\n<td align=\"center\" class=\"text\">{gortium}</td>\n<td align=\"center\" class=\"text\">{susebloom}</td>\n<td align=\"center\" class=\"text\">{money}</td>\n<td align=\"center\" class=\"text\">{colonists}</td>\n<td align=\"center\" class=\"text\">{date}</td>\n</tr>"; table_end();
function start_mission() { global $id; global $uid; global $PHP_SELF; global $imperium; global $pid; $sth = mysql_query("select sum(population) from planets where uid={$uid}"); if (!$sth) { show_error("Database error!"); return 0; } $pop = mysql_fetch_row($sth); $spies = floor($pop[0] / 1000); $sth = mysql_query("select sum(count) from covertops where uid={$uid}"); if (!$sth) { show_error("Database failure!"); return 0; } $count = mysql_fetch_row($sth); if ($count[0] == NULL) { $count[0] = 0; } if ($count[0] == 0 and $spies == 0) { show_message("You don't have enough population to do any covertops!"); return 0; } $sth = mysql_query("select * from covertopsmissions as c , research as r where c.techdepend=r.t_id and r.uid={$uid} and c.id={$id}"); if (!$sth) { show_error("Database error!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("bbbblllllllllllll"); return 0; } $covertops = mysql_fetch_array($sth); if ($spies - $count[0] < $covertops["count"]) { show_message("You don't have enough free spies!"); return 0; } $sth = mysql_query("select c.id from covertopsmissions as c,ressources as r where c.metal<=r.metal and c.energy<=r.energy and c.mopgas<=r.mopgas and c.erkunum<=r.erkunum and c.gortium<=r.gortium and c.susebloom<=r.susebloom and r.uid={$uid} and c.id={$id}"); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("You don't have enough ressources to start this mission!"); show_status(); return 0; } if ($imperium != "") { //$sth=mysql_query("select id from users where imperium='".addslashes($imperium)."' and id!=$uid"); $sth = mysql_query("select id from users where imperium='" . $imperium . "' and id!={$uid}"); if (!$sth) { show_error("Database error!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("Hund! 1"); return 0; } if ($covertops["targettype"] == "P" && $pid == "") { $sth = mysql_query("select id from users where imperium='{$imperium}'"); if (!$sth) { show_error("Database failure13!"); return 0; } $uid_target = mysql_fetch_array($sth); $sth = mysql_query("select id,name from planets where uid=" . $uid_target["id"] . " order by name"); if (!$sth) { show_error("Database failure!12"); return 0; } while ($planets = mysql_fetch_array($sth)) { if ($planets["name"] == "Unnamed") { $planets["name"] = get_planetname($planets["id"]); } $select[$planets["name"]] = $planets["id"]; } echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_start("center", "500"); table_head_text(array("Mission: " . $covertops["descr"]), "2"); table_text(array(" "), "", "", "2", "center", "head"); table_text_open("text", "center"); table_text_design("<img src='arts/idnummer.jpg' width='75' height='50' alt='" . $covertops["descr"] . "'>", "75"); table_text_design($covertops["descr"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Target empire", "75"); table_text_design($imperium, "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Time", "75"); table_text_design($covertops["time"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Special Info", "75"); table_text_design("dummy", "425"); table_text_close(); table_form_select("Select the targetplanet", "pid", $select, "2", "text", "text"); table_form_submit("Start", "start_mission", "2", "text"); table_end(); form_hidden("imperium", $imperium); form_hidden("id", $id); echo "</form>"; table_end(); } elseif ($covertops["targettype"] == "P") { $sth = mysql_query("select id from planets where id={$pid} and uid!={$uid} and uid!=0"); if (!$sth) { show_error("Database failure!1"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("Hund! 2"); return 0; } proc_start_mission($covertops["id"], $uid, $pid); show_status(); } else { $sth = mysql_query("select id from users where id!={$uid} and imperium='{$imperium}'"); if (!$sth) { show_error("Database failure1!"); return 0; } if (mysql_num_rows($sth) == 0) { show_message("Du Klobrillenvergewaltiger!"); return 0; } $target_uid = mysql_fetch_array($sth); proc_start_mission($covertops["id"], $uid, $target_uid["id"]); show_status(); } } else { $sth = mysql_query("select imperium from users where id!={$uid} order by imperium"); if (!$sth) { show_error("Database failure!"); return 0; } while ($imperiums = mysql_fetch_array($sth)) { $select[$imperiums["imperium"]] = $imperiums["imperium"]; } echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_start("center", "500"); table_head_text(array("Mission: " . $covertops["descr"]), "2"); table_text(array(" "), "", "", "2", "head"); table_text_open("text", "center"); table_text_design("<img src='arts/o" . $covertops["id"] . ".jpg' width='75' height='50' alt='" . $covertops["descr"] . "'>", "75"); table_text_design($covertops["descr"], "425"); table_text_close(); table_text_open("text", "center"); table_text_design("Time", "75"); table_text_design($covertops["time"], "425", "head"); table_text_close(); table_text_open("text", "center"); table_text_design("Special Info", "75"); table_text_design("dummy", "425", "head"); table_text_close(); table_form_select("Select the target empire", "imperium", $select, "", "text", "text"); table_form_submit("Start", "start_mission", "2", "text"); table_end(); form_hidden("id", $id); echo "</form>"; } }
function status() { global $uid; $sth = mysql_query("select * from researching where uid={$uid}"); if (!$sth) { show_message("Database Failure!"); return 0; } $status = mysql_fetch_array($sth); table_start("center", "500"); table_head_text(array("Current research"), "5"); table_text(array(" "), "", "", "5", "text"); if ($status != "") { $sth2 = mysql_query("select * from tech where t_id=" . $status["t_id"] . ""); $tech = mysql_fetch_array($sth2); table_text(array("<br><strong>" . $tech["name"] . "</strong>"), "center", "", "5", "head"); table_text(array("<img src='arts/t" . $tech["t_id"] . "big.jpg' width='100' height='100' alt='" . $tech["name"] . "' align='left'>\n <br>" . $tech["description"] . "\n <br><a href='manual/tech" . $tech["t_id"] . ".html'>learn more</a>"), "center", "", "5", "text"); table_text_open(); table_text_design("Time left:", "100", "center", "3", "head"); table_text_design($status["time"], "400", "center", "2", "text"); table_text_close(); print_advancements($status["t_id"]); table_end(); } else { table_text(array("<br><strong>No Research established</strong>"), "center", "", "5", "head"); table_end(); } echo "<br><br>\n"; // mop: research_queue holen $queue = get_research_queue($uid); table_start("center", "500"); table_head_text(array("Research queue"), sizeof($queue)); table_text(array(" "), "", "", sizeof($queue), "text"); if (sizeof($queue) == 0) { table_text(array("<br><strong>Research queue is empty</strong>"), "center", "", sizeof($queue), "head"); } else { $output_arr = array(); $option_arr = array(); for ($i = 0; $i < sizeof($queue); $i++) { $t_id = $queue[$i]; $sth2 = mysql_query("select * from tech where t_id=" . $t_id); $tech = mysql_fetch_assoc($sth2); $output_arr[] = "<img src='arts/t" . $t_id . ".jpg' alt='" . $tech["name"] . "' align='center'>"; // mop: optionen dazu bauen $options = ""; if ($i != 0) { $options .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?act=qmove&direction=l&tid=" . $t_id . "\"><</a>"; } $options .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?act=qremove&tid=" . $t_id . "\">x</a>"; if ($i != sizeof($queue) - 1) { $options .= "<a href=\"" . $_SERVER["PHP_SELF"] . "?act=qmove&direction=r&tid=" . $t_id . "\">></a>"; } $option_arr[] = $options; } table_text($output_arr, "center"); table_text($option_arr, "center"); } table_end(); echo "<br><br>\n"; }
echo "<meta name=\\MSSmartTagsPreventParsing\\ content=\\TRUE\\>"; echo "</head>"; echo "<body link=\"#b0aed9\" vlink=\"#b0aed9\" alink=\"#320ff9\" text=\"#cdc9f5\">"; $not_ok = false; } $sth = mysql_query("select u.id,s.name from users as u, skins as s where u.name='{$sr_name}' and u.skin=s.id"); $uid_db = mysql_fetch_array($sth); $uid = $uid_db["id"]; $skin = $uid_db["name"]; $sth = mysql_query("select * from ressources where uid={$uid}"); if (!$sth) { show_error("Datenbankfehler!"); return 0; } $date = date("YmdHis"); $date = substr($date, 6, 2) . "." . substr($date, 4, 2) . "." . substr($date, 0, 4) . " " . substr($date, 8, 2) . ":" . substr($date, 10, 2); $data = mysql_fetch_array($sth); $sth = mysql_query("select * from ads order by rand() limit 1"); if (!$sth) { show_error("Database failure!"); return 0; } $ad = mysql_fetch_array($sth); table_start("center"); table_text(array("<a href=\"ad.php?id=" . $ad["id"] . "\" target=\"_blank\"><img src=\"" . $ad["image"] . "\"></a>")); table_text(array(" ")); table_end(); table_start("center"); table_head_text(array("<a href=\"manual/metal_help.html\" target=\"_blank\"><img src=\"arts/metal.gif\" title=\"Metal\" alt=\"Metal\" border=\"0\"></a>", "<a href=\"manual/energy_help.html\" target=\"_blank\"><img src=\"arts/energy.gif\" title=\"Energy\" alt=\"Energy\" border=\"0\"></a>", "<a href=\"manual/mopgas_help.html\" target=\"_blank\"><img src=\"arts/mopgas.gif\" title=\"MopGas\" alt=\"MopGas\" border=\"0\"></a>", "<a href=\"manual/erkunum_help.html\" target=\"_blank\"><img src=\"arts/erkunum.gif\" title=\"Erkunum\" alt=\"Erkunum\" border=\"0\"></a>", "<a href=\"manual/gortium_help.html\" target=\"_blank\"><img src=\"arts/gortium.gif\" title=\"Gortium\" alt=\"Gortium\" border=\"0\"></a>", "<a href=\"manual/susebloom_help.html\" target=\"_blank\"><img src=\"arts/susebloom.gif\" title=\"Susebloom\" alt=\"Susebloom\" border=\"0\"></a>", " ", "Date")); table_text(array($data["metal"], $data["energy"], $data["mopgas"], $data["erkunum"], $data["gortium"], $data["susebloom"], " ", $date), "center", "", "", "head"); table_end();
function info_alliance() { global $aid; global $PHP_SELF; $sth = mysql_query("select * from users where alliance={$aid} order by name"); $sth1 = mysql_query("select * from alliance where id={$aid}"); $alliance = mysql_fetch_array($sth1); if (!$sth) { show_message("Database failure"); return 0; } if (!$sth1) { show_message("Database failure"); return 0; } center_headline("Alliance " . $alliance["name"] . ""); echo "<br><br>\n"; table_start("center", "500"); table_head_text(array("Picture")); table_text(array(" "), "", "", "", "head"); if ($alliance["picture"] != "") { table_text(array("<img src=\"" . $alliance["picture"] . "\" border=\"0\" align=\"center\">"), "center", "", "", "text"); } else { table_text(array("No Picture available"), "center", "", "", "text"); } if ($alliance["url"] != "") { table_text(array("<a href=\"" . $alliance["url"] . "\" target=\"_blank\">" . $alliance["url"] . "</a>"), "center"); } else { table_text(array("No Homepage available"), "center", "", "", "text"); } table_end(); echo "<br>\n"; table_start("center", "500"); table_head_text(array("Alliance Information"), "2"); table_text(array(" "), "", "", "", "head"); if ($alliance["info"] != "") { table_text(array(nl2br($alliance["info"])), "", "", "", "text"); } else { table_text(array("No information available"), "", "", "", "text"); } table_end(); echo "<br>\n"; table_start("center", "500"); table_head_text(array("Members"), "2"); table_text(array(" "), "", "", "2", "text"); table_text_open("head", "center"); table_text_design("Name", "225", "center", "", "head"); table_text_design("Empire", "225", "center", "", "head"); table_text_close(); while ($users = mysql_fetch_array($sth)) { table_text_open(); switch ($users["id"]) { case $alliance["leader"]: $class = "leader"; $color = "#000000"; break; case $alliance["devminister"]: $class = "dev"; $color = "#000000"; break; case $alliance["milminister"]: $class = "military"; $color = "#ffffff"; break; case $alliance["forminister"]: $class = "foreign"; $color = "#000000"; break; default: $class = "text"; $color = ""; } table_text_design("<a class=\"" . $class . "\" href=\"mail.php?act=show_messages&name=" . $users["name"] . "#mailform\">" . $users["name"] . "</a>", "", "", "", $class); table_text_design($users["imperium"], "", "", "", $class); table_text_close(); } table_end(); echo "<br>\n"; table_start("center", "500"); table_text_open("head", "center"); table_text_design(" ", "25", "", "", "leader"); table_text_design("Leader", "100", "", "", "head"); table_text_design(" ", "25", "", "", "dev"); table_text_design("Developement", "100", "", "", "head"); table_text_design(" ", "25", "", "", "military"); table_text_design("Military", "100", "", "", "head"); table_text_design(" ", "25", "", "", "foreign"); table_text_design("Foreign", "100", "", "", "head"); table_text_close(); table_end(); echo "<br>"; $sth = mysql_query("select a.name, d.alliance2, d.status from diplomacy d, alliance a where d.alliance1='" . $aid . "' and a.id = d.alliance2 and d.status != 1 order by d.status, a.name"); if (!$sth) { echo "ERR::DATABASE.PHP, could not get relationships"; return false; } table_start("center", "500"); table_text_open("head", "center"); table_text_design(" ", "27", "left", "", "head"); table_text_design("Alliance Relations", "", "left", "", "head"); table_text_close(); if (mysql_num_rows($sth) > 0) { while ($diplomacy = mysql_fetch_assoc($sth)) { if ($diplomacy["status"] == 0) { $dip_image = "arts/alliance_enemy.gif"; $alt = "Enemy"; } else { $dip_image = "arts/alliance_friend.gif"; $alt = "Friend"; } table_text_open("head", "center"); table_text_design("<img src=\"" . $dip_image . "\" width=\"25\" height=\"25\" alt=\"" . $alt . "\" border=\"0\" />", "27", "center", "", "text"); table_text_design("<a href=\"" . $PHP_SELF . "?act=info_alliance&aid=" . $diplomacy["alliance2"] . "\">" . $diplomacy["name"] . "</a>", "", "left", "", "text"); table_text_close(); } } else { table_text(array("no relations to other alliances"), "center", "", "2", "text"); } table_end(); }
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(" ", "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(" ", " ", " ", " ", " "), "center", "100", "", "text"); table_text_open("head"); table_text_design("Infantry", "200", "center", "2", "head"); table_text_design(" ", "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(" ", "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(" ", "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(" "); table_text_design(" "); table_text_design(" ", "100", "", "", "none"); table_text_design("Olymp Class", "", "", "", "text"); table_text_design(get_fcount_by_type($uid, "H", $pid), "", "", "", "text"); table_text_close(); table_end(); }
function show_menu() { global $PHP_SELF; table_start("center", "80%"); table_head_text(array("Menu"), "12"); echo "<tr align=\"center\" class=\"head\">\r\n <td>Subjekt</td>\r\n <td>Priorität</td>\r\n <td>Typ</td>\r\n </tr>\n"; echo "\n"; echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=add\">"; echo "<tr align=\"center\">\n"; echo "<td><input type=\"text\" name=\"subject\" size=\"40\" maxsize=\"255\" /></td>"; echo "<td><select name=\"priority\" size=\"1\"><option>1 <option>2 <option>3</select></td>\n"; echo "<td><select name=\"typ\" size=\"1\">"; $sth = mysql_query("select id, name from typ"); if (!$sth || !mysql_num_rows($sth)) { return 0; } while ($its_types = mysql_fetch_array($sth)) { echo "<option value=\"" . $its_types["id"] . "\">" . $its_types["name"]; } echo "</tr>"; echo "<tr>"; echo "<td colspan=\"3\">Description: <textarea type=\"text\" name=\"description\" cols=\"80\" rows=\"10\"></textarea></td>"; echo "</tr>"; echo "<tr>"; echo "<td colspan=\"3\"><input type=\"submit\" value=\"add\" /></td></tr>"; echo "</tr>"; echo "</table>\n"; }
function print_ship_info($prod_id) { if ($info = get_ship_info($prod_id)) { table_start("center", "500"); table_head_text(array("Ships info for " . $info["name"]), "6"); table_text_open("head"); table_text_design(" ", "500", "", "2", "head"); table_text_close(); $info["p_depend"] = get_name_by_prod_id($info["p_depend"]); switch ($info["target1"]) { case "L": $info["target1"] = "Europe Class"; break; case "M": $info["target1"] = "Zeus Class"; break; case "H": $info["target1"] = "Olymp Class"; break; } switch ($info["special"]) { case "E": $info["special"] = "Freezes enemy ships"; break; case "R": $info["special"] = "Capable of stealing ships"; break; case "S": $info["special"] = "Detects cloaked ships"; break; case "C": $info["special"] = "Cloaked"; break; default: $info["special"] = "Nothing"; } foreach (array("name" => "Name", "metal" => "Metal", "energy" => "Energy", "mopgas" => "Mopgas", "erkunum" => "Erkunum", "gortium" => "Gortium", "susebloom" => "Susebloom", "rname" => "Needs tech", "p_depend" => "Needs building", "initiative" => "Initiative", "agility" => "Agility", "warpreload" => "Reload time", "hull" => "Hull", "tonnage" => "Tonnage", "weaponpower" => "Weaponpower", "shield" => "Shield", "ecm" => "ECM", "sensor" => "Sensor", "weaponskill" => "Weaponskill", "target1" => "Attacks", "special" => "Special abilities", "num_attacks" => "Number of attacks") as $key => $show) { table_text_open("text"); table_text_design($show, "250", "", "", "text"); table_text_design($info[$key], "250", "", "", "text"); table_text_close(); } table_end(); } else { show_error("Can't get ship info!"); return 0; } }
function show_fleet() { global $fid; global $uid; $no_scan = 100; $sth = mysql_query("select u.alliance,u.id from fleet_info as f,users as u where u.id=f.uid and f.fid={$fid} limit 1"); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("Either this fleet doesn't exist or you are trying to hack :)"); return 0; } $sth = mysql_query("select alliance from users where id={$uid}"); if (!$sth) { show_error("Database failure!"); return 0; } $u_alliance = mysql_fetch_array($sth); $sth = mysql_query("select u.alliance,u.id from users as u,fleet_info as f where f.uid=u.id and f.fid={$fid} and u.alliance!=0"); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) == 0) { $allowed = false; } else { $f_alliance = mysql_fetch_array($sth); if ($f_alliance["id"] == $uid) { $allowed = true; } elseif ($f_alliance["alliance"] == $u_alliance["alliance"] and $u_alliance != 0) { $allowed = true; } else { $allowed = false; } } if (!$allowed) { $sth = mysql_query("select sid from fleet_info where fid={$fid}"); if (!$sth) { show_error("Database failure!"); return 0; } $system = mysql_fetch_array($sth); $sth = mysql_query("select fid from fleet_info where uid={$uid} and sid=" . $system["sid"]); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) > 0) { $allowed = true; } } if (!$allowed) { $sth = mysql_query("select p.id,p.uid,p.name,s.x,s.y from planets as p,systems as s where uid={$uid} and p.sid=s.id"); if (!$sth) { show_error("Database failure!"); return 0; } $allowed = false; while ($planets = mysql_fetch_array($sth) and !$allowed) { $sth1 = mysql_query("select max(s.radius) from scanradius as s,constructions as o where s.prod_id=o.prod_id and o.pid=" . $planets["id"]); if (!$sth1) { show_error("Dataabse failure!"); return 0; } $radius = mysql_fetch_row($sth1); if ($radius[0] == NULL) { $radius[0] = $no_scan; } $sth1 = mysql_query("select * from systems as s,fleet_info as f where (s.x-" . $planets["x"] . ")*(s.x-" . $planets["x"] . ")+(s.y-" . $planets["y"] . ")*(s.y-" . $planets["y"] . ")<=" . $radius[0] . "*" . $radius[0] . " and f.sid=s.id and f.fid={$fid}"); if (!$sth1) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth1) > 0) { $allowed = true; } } } if (!$allowed) { show_error("Your scanning abilities aren't sufficient to view this fleet!"); return 0; } $sth = mysql_query("select f.count,f.fid,f.prod_id,p.name from fleet as f, production as p where p.prod_id=f.prod_id and f.fid={$fid}"); if (!$sth) { show_error("Database failure!"); return 0; } if (mysql_num_rows($sth) == 0) { show_error("Either this fleet doesn't exist or you are trying to hack :)"); return 0; } table_start("center", "500"); table_head_text(array("Fleet Overview"), "2"); while ($fleet = mysql_fetch_array($sth)) { table_text_open("head", "center"); table_text_design($fleet["name"], "250", "", "", "text"); table_text_design($fleet["count"], "250", "", "", "text"); table_text_close(); } }
function show_rankings_menu() { global $PHP_SELF; echo "<br />"; echo "<a name=\"top\" />\n"; table_start("center", "500", 4); table_head_text(array("Rankings"), "5"); table_text_open("text"); table_text_design("<br>", "", "", "5", "text"); table_text_close(); table_text_open("head"); table_text_design("Users", "", "", "2", "head"); table_text_design(" ", "", "", "", "head"); table_text_design("Alliances", "", "", "2", "head"); table_text_close(); table_text_open("head"); table_text_design("· <a href=\"" . $PHP_SELF . "\">Score</a>", "", "", "2", "text"); table_text_design(" ", "", "", "", "text"); table_text_design("· <a href=\"" . $PHP_SELF . "?act=show_alliance_rankings\">Score</a>", "", "", "2", "text"); table_text_close(); table_text_open("text"); table_text_design("· <a href=\"" . $PHP_SELF . "?act=show_planets_rankings\">Planets (Top 100)</a>", "", "", "2", "text"); table_text_design(" ", "", "", "", "text"); table_text_design(" ", "", "", "2", "text"); table_text_close(); table_text_open("text"); table_text_design("· <a href=\"" . $PHP_SELF . "?act=show_ships_rankings\">Ships (Top 100)</a>", "", "", "2", "text"); table_text_design(" ", "", "", "", "text"); table_text_design(" ", "", "", "2", "text"); table_text_close(); table_text_open("text"); table_text_design("<br>", "", "", "5", "text"); table_text_close(); }
function show_battlereports() { 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>"; }
function show_taxes() { global $uid; global $PHP_SELF; $sth = mysql_query("select t.*,u.alliance,u.id from taxes as t, users as u where u.id='{$uid}' and u.alliance=t.aid"); if (!$sth) { show_message("Database Failure"); return 0; } $tax = mysql_fetch_array($sth); $sth = mysql_query("select name, devminister from alliance where id=" . $tax["aid"] . ""); if (!$sth) { show_message("Database Failure"); return 0; } $alliance = mysql_fetch_array($sth); center_headline("Taxes"); echo "<br>\n"; table_start("center", "500"); if ($alliance["devminister"] == $uid) { $o = ""; for ($i = 0; $i <= 30; $i++) { $o .= "<option value=\"" . $i . "\">" . $i . "%"; } table_start("center", "500"); table_head_text(array("Your options as Minister of Developement"), "5"); table_text(array(" "), "", "", "5", "text"); table_text(array("Tax", "Rate", "Total income last turn", "Set", " "), "center", "", "", "head"); table_text_open(); echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text_design("<img src=\"arts/metal.gif\" alt=\"metal\">", "", "center", "", "text"); table_text_design($tax["taxmetal"] . "%", "50", "center", "", "text"); table_text_design($tax["incomemetal"] . " units", "330", "center", "", "text"); table_text_design("<select name=\"resource\">" . $o . "</select>", "50", "center", "", "text"); table_text_design("<input type=\"hidden\" value=\"metal\" name=\"type\"><input type=\"submit\" value=\"set\">", "50", "center", "", "text"); echo "</form>\n"; table_text_close(); echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text(array("<img src=\"arts/energy.gif\" alt=\"Energy\">", $tax["taxenergy"] . "%", $tax["incomeenergy"] . " units", "<select name=\"resource\">" . $o . "</select>", "<input type=\"hidden\" value=\"energy\" name=\"type\"><input type=\"submit\" value=\"set\">"), "center", "", "", "text"); echo "</form>\n"; echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text(array("<img src=\"arts/mopgas.gif\" alt=\"Mopgas\">", $tax["taxmopgas"] . "%", $tax["incomemopgas"] . " units", "<select name=\"resource\">" . $o . "</select>", "<input type=\"hidden\" value=\"mopgas\" name=\"type\"><input type=\"submit\" value=\"set\">"), "center", "", "", "text"); echo "</form>\n"; echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text(array("<img src=\"arts/erkunum.gif\" alt=\"Erkunum\">", $tax["taxerkunum"] . "%", $tax["incomeerkunum"] . " units", "<select name=\"resource\">" . $o . "</select>", "<input type=\"hidden\" value=\"erkunum\" name=\"type\"><input type=\"submit\" value=\"set\">"), "center", "", "", "text"); echo "</form>\n"; echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text(array("<img src=\"arts/gortium.gif\" alt=\"Gortium\">", $tax["taxgortium"] . "%", $tax["incomegortium"] . " units", "<select name=\"resource\">" . $o . "</select>", "<input type=\"hidden\" value=\"gortium\" name=\"type\"><input type=\"submit\" value=\"set\">"), "center", "", "", "text"); echo "</form>\n"; echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text(array("<img src=\"arts/susebloom.gif\" alt=\"Susebloom\">", $tax["taxsusebloom"] . "%", $tax["incomesusebloom"] . " units", "<select name=\"resource\">" . $o . "</select>", "<input type=\"hidden\" value=\"susebloom\" name=\"type\"><input type=\"submit\" value=\"set\">"), "center", "", "", "text"); echo "</form>\n"; $taxsum = 100 - ($tax["taxleader"] + $tax["taxdevelopement"] + $tax["taxmilitary"] + $tax["taxforeign"]); $o = "<option value=\"0\">0%"; for ($i = 1; $i <= $tax["taxleader"] + $taxsum; $i++) { if ($i == $tax["taxleader"]) { $o = $o . "<option value=\"" . $i . "\" selected>" . $i . "%"; } else { $o = $o . "<option value=\"" . $i . "\">" . $i . "%"; } } table_text(array(" "), "center", "", "5", "text"); echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text_open(); table_text_design("Leader received (" . $tax["taxleader"] . "%)", "", "center", "3", "head"); table_text_design("<select name=\"resource\">" . $o . "</select>", "", "center", "", "head"); table_text_design("<input type=\"hidden\" value=\"leader\" name=\"type\"><input type=\"submit\" value=\"set\">", "", "center", "", "head"); table_text_close(); echo "</form>\n"; table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxleader"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxleader"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxleader"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxleader"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxleader"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxleader"] / 100) . ""), "center", "", "5", "text"); $o = "<option value=\"0\">0%"; for ($i = 1; $i <= $tax["taxdevelopement"] + $taxsum; $i++) { if ($i == $tax["taxdevelopement"]) { $o = $o . "<option value=\"" . $i . "\" selected>" . $i . "%"; } else { $o = $o . "<option value=\"" . $i . "\">" . $i . "%"; } } echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text_open(); table_text_design("Minister of Developement received (" . $tax["taxdevelopement"] . "%)", "", "center", "3", "head"); table_text_design("<select name=\"resource\">" . $o . "</select>", "", "center", "", "head"); table_text_design("<input type=\"hidden\" value=\"developement\" name=\"type\"><input type=\"submit\" value=\"set\">", "", "center", "", "head"); table_text_close(); echo "</form>\n"; table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxdevelopement"] / 100) . ""), "center", "", "5", "text"); $o = "<option value=\"0\">0%"; for ($i = 1; $i <= $tax["taxmilitary"] + $taxsum; $i++) { if ($i == $tax["taxmilitary"]) { $o = $o . "<option value=\"" . $i . "\" selected>" . $i . "%"; } else { $o = $o . "<option value=\"" . $i . "\">" . $i . "%"; } } echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text_open(); table_text_design("Minister of Defence received (" . $tax["taxmilitary"] . "%)", "", "center", "3", "head"); table_text_design("<select name=\"resource\">" . $o . "</select>", "", "center", "", "head"); table_text_design("<input type=\"hidden\" value=\"military\" name=\"type\"><input type=\"submit\" value=\"set\">", "", "center", "", "head"); table_text_close(); echo "</form>\n"; table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxmilitary"] / 100) . ""), "center", "", "5", "text"); $o = "<option value=\"0\">0%"; for ($i = 1; $i <= $tax["taxforeign"] + $taxsum; $i++) { if ($i == $tax["taxforeign"]) { $o = $o . "<option value=\"" . $i . "\" selected>" . $i . "%"; } else { $o = $o . "<option value=\"" . $i . "\">" . $i . "%"; } } echo "<form method=\"post\" action=\"" . $PHP_SELF . "?act=set_tax\">\n"; table_text_open(); table_text_design("Foreign Minister received (" . $tax["taxforeign"] . "%)", "", "center", "3", "head"); table_text_design("<select name=\"resource\">" . $o . "</select>", "", "center", "", "head"); table_text_design("<input type=\"hidden\" value=\"foreign\" name=\"type\"><input type=\"submit\" value=\"set\">", "", "center", "", "head"); table_text_close(); echo "</form>\n"; table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxforeign"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxforeign"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxforeign"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxforeign"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxforeign"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxforeign"] / 100) . ""), "center", "", "5", "text"); table_end(); } else { table_head_text(array("Taxrate of Alliance: " . $alliance["name"]), "3"); table_text(array(" "), "", "", "3", "text"); table_text(array("Tax", "Rate", "Total income last turn"), "center", "", "", "head"); table_text_open(); table_text_design("<img src=\"arts/metal.gif\" alt=\"metal\">", "", "center", "", "text"); table_text_design($tax["taxmetal"] . "%", "50", "center", "", "text"); table_text_design($tax["incomemetal"] . " units", "430", "center", "", "text"); table_text_close(); table_text(array("<img src=\"arts/energy.gif\" alt=\"Energy\">", $tax["taxenergy"] . "%", $tax["incomeenergy"] . " units"), "center", "", "", "text"); table_text(array("<img src=\"arts/mopgas.gif\" alt=\"Mopgas\">", $tax["taxmopgas"] . "%", $tax["incomemopgas"] . " units"), "center", "", "", "text"); table_text(array("<img src=\"arts/erkunum.gif\" alt=\"Erkunum\">", $tax["taxerkunum"] . "%", $tax["incomeerkunum"] . " units"), "center", "", "", "text"); table_text(array("<img src=\"arts/gortium.gif\" alt=\"Gortium\">", $tax["taxgortium"] . "%", $tax["incomegortium"] . " units"), "center", "", "", "text"); table_text(array("<img src=\"arts/susebloom.gif\" alt=\"Susebloom\">", $tax["taxsusebloom"] . "%", $tax["incomesusebloom"] . " units"), "center", "", "", "text"); table_text(array(" "), "center", "", "3", "text"); table_text(array("Leader recieved (" . $tax["taxleader"] . "%)"), "center", "", "3", "head"); table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxleader"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxleader"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxleader"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxleader"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxleader"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxleader"] / 100) . ""), "center", "", "3", "text"); table_text(array("Minister of Developement recieved (" . $tax["taxdevelopement"] . "%)"), "center", "", "3", "head"); table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxdevelopement"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxdevelopement"] / 100) . ""), "center", "", "3", "text"); table_text(array("Minister of Defence recieved (" . $tax["taxmilitary"] . "%)"), "center", "", "3", "head"); table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxmilitary"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxmilitary"] / 100) . ""), "center", "", "3", "text"); table_text(array("Foreign Minister recieved (" . $tax["taxforeign"] . "%)"), "center", "", "3", "head"); table_text(array("<img src=\"arts/metal.gif\" alt=\"metal\"> " . round($tax["incomemetal"] * $tax["taxforeign"] / 100) . " <img src=\"arts/energy.gif\" alt=\"energy\"> " . round($tax["incomeenergy"] * $tax["taxforeign"] / 100) . " <img src=\"arts/mopgas.gif\" alt=\"mopgas\"> " . round($tax["incomemopgas"] * $tax["taxforeign"] / 100) . " <img src=\"arts/erkunum.gif\" alt=\"Erkunum\"> " . round($tax["incomeerkunum"] * $tax["taxforeign"] / 100) . " <img src=\"arts/gortium.gif\" alt=\"Gortium\"> " . round($tax["incomegortium"] * $tax["taxforeign"] / 100) . " <img src=\"arts/susebloom.gif\" alt=\"Susebloom\"> " . round($tax["incomesusebloom"] * $tax["taxforeign"] / 100) . ""), "center", "", "3", "text"); table_end(); } echo "<br><br>\n"; }
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(" "), "", "", "7", "text"); table_text_open(); table_text_design(" ", "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(); }