function act_code() { global $PHP_SELF; global $name; global $act_code; global $password; if ($act_code != "") { $sth = mysql_query("select ac.code from users as u,activationcodes as ac where u.id=ac.uid and u.name='{$name}'"); $code = mysql_fetch_array($sth); if ($code["code"] == $act_code) { mysql_query("update users set active=1 where name='{$name}'"); return 1; } else { return 0; } } else { echo "<body bgcolor=\"black\"><center><font color=\"white\">"; echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_start(); echo "<p>Please enter your Activation Code</p>"; table_form_text("", "act_code", ""); table_end(); form_hidden("name", $name); form_hidden("password", $password); form_submit("Submit"); echo "</form></center></font>"; echo "</body>"; table_end(); return 0; } }
function print_table_start($title = "", $col = "", $width = 100) { table_start("center", "100%"); table_head_text(array($title)); table_end(); table_start("center", "100%"); }
function display_orders($status) { $warehouse = SCA::getService('../WarehouseService/WarehouseService.php'); $orders = $warehouse->getOrdersByStatus($status); if (count($orders->order) == 0) { echo "None\n"; return; } include_once "./table.php"; table_start(); table_row_start(); table_cell('<b>Order ID</b>', '#DDDDFF'); table_cell('<b>Name</b>', '#DDDDFF'); table_cell('<b>Status</b>', '#DDDDFF'); table_row_end(); $odd = false; foreach ($orders->order as $order) { table_row_start(); if (!$odd) { table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>"); table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied'); table_cell($order->status); } else { table_cell("<a href=\"./order_details.php?orderId=" . $order->orderId . "\">" . $order->orderId . "</a>", '#DDFFFF'); table_cell(isset($order->customer->name) ? $order->customer->name : 'no name supplied', '#DDFFFF'); table_cell($order->status, '#DDFFFF'); } $odd = !$odd; table_row_end(); } table_end(); }
function display_cart($cart) { $cell_colour = "#DDFFFF"; table_start(); table_row_start(); table_cell('<b>Product</b>', $cell_colour); table_cell('<b>Quantity</b>', $cell_colour); table_cell('<b>Price</b>', $cell_colour); table_row_end(); $total = 0; foreach ($cart->item as $value) { table_row_start(); table_cell($value->description); table_cell($value->quantity); table_cell($value->price * $value->quantity); $total += $value->price * $value->quantity; table_row_end(); } table_row_start(); table_cell(''); table_cell('<b> Total </b>', $cell_colour); table_cell("<b>{$total}<b>", $cell_colour); table_row_end(); table_end(); }
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 display_catalog($catalog) { table_start(); table_row_start(); table_cell('Product'); table_cell('Price'); table_row_end(); foreach ($catalog->item as $value) { table_row_start(); table_cell('<a href="view_product.php?product_code=' . $value->itemId . '">' . $value->description . '</a>'); table_cell($value->price); table_row_end(); } table_end(); }
function display_customer_form() { $customer_labels = array('Name'); $address_labels = array('Street', 'City', 'State', 'Zip'); $payment_labels = array('Bank', 'Account', 'SecurityCode'); echo '</br><b>Enter your details:</b></br></br>'; echo '<form method=POST action="submit_order.php">'; table_start(); display_form($customer_labels); display_form($address_labels); display_form($payment_labels); table_end(); echo '<input type=submit name="Order" value="Submit Order"/></br>'; echo '</form>'; }
function display_events($events) { include_once "table.php"; table_start(); table_row_start(); table_cell('<b>Date</b>', '#DDDDFF'); table_cell('<b>Status</b>', '#DDDDFF'); table_cell('<b>Description</b>', '#DDDDFF'); table_row_end(); foreach ($events->event as $event) { table_row_start(); table_cell($event->timeStamp); table_cell($event->status); table_cell($event->description); table_row_end(); } table_end(); }
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_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 show_stock_ticker() { global $uid; $sth = mysql_query("SELECT time, message FROM stockmarket_ticker WHERE uid=" . $uid . " ORDER BY time"); if (!$sth) { show_error("ERROR::GET TRADE TICKER"); return false; } if (mysql_num_rows($sth) == 0) { table_start("center", 500); table_text(array("Trade Ticker"), "", "", "", "head"); table_text(array("No transactions"), "", "", "", "text"); table_end(); } else { table_start("center", 500); table_text(array("Trade Ticker"), "", "", "2", "head"); while ($ticker = mysql_fetch_row($sth)) { table_text(array($ticker[0], $ticker[1]), "", "", "", "text"); } table_end(); echo "<br />\n"; $sth = mysql_query("DELETE FROM stockmarket_ticker WHERE uid=" . $uid); if (!$sth) { show_error("ERROR::GET DELETE TICKER"); return false; } } }
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 table_edit($tablename, $home = "", $action = "", $id = "", $masterfield = "", $mastervalue = "", $order = "", $actionstring_or_function = "") { if (!$home) { $home = self_q(); } if (!$action) { $action = arg(0); } if (!$id) { $id = arg(1); } global $table_edit_props; $actionstring = $actionstring_or_function; ////////////// PREPARE $table_long_alias = $tablename; global $tables; if (isset($tables[$tablename]['weight'])) { weight_fix($tablename); } $table_long_alias = table_long_alias($tablename); ///////////////////////////////////// $master_cond = ""; if ($masterfield) { if (strtolower($mastervalue) == 'null') { $master_cond = " AND {$masterfield} is null"; } else { $master_cond = " AND {$masterfield}='{$mastervalue}' "; } } global $tables; if (!isset($tables[$tablename])) { die("error, table_edit - tables[{$tablename}] not set"); } if (isset($tables[$tablename]['weight'])) { if ($order) { $order .= ","; } $order .= " {$tablename}.weight "; } if ($order) { $order = " ORDER BY {$order} "; } //this is reaction on drag and drop reorder if ($action == "move") { $d = $_REQUEST['delta']; if ($d > 0) { for ($i = 0; $i < $d; $i++) { table_edit($tablename, "return!", "down", $id, $masterfield, $mastervalue); } } if ($d < 0) { $d = -$d; for ($i = 0; $i < $d; $i++) { table_edit($tablename, "return!", "up", $id, $masterfield, $mastervalue); } } die(""); } if ($action == "up") { $weight = db_result(db_query("SELECT weight FROM {$tablename} WHERE id=%d {$master_cond}", $id)); $prevweight = db_result(db_query("SELECT max(weight) FROM {$tablename} WHERE weight<%f {$master_cond}", $weight)); $previd = db_result(db_query("SELECT id FROM {$tablename} WHERE weight=%f {$master_cond}", $prevweight)); db_query("UPDATE {$tablename} SET weight=%f WHERE id=%d {$master_cond}", $prevweight, $id); db_query("UPDATE {$tablename} SET weight=%f WHERE id=%d {$master_cond}", $weight, $previd); if ($home == 'return!') { return; } redir($home); } if ($action == "down") { $weight = db_result(db_query("SELECT weight FROM {$tablename} WHERE id=%d {$master_cond}", $id)); $prevweight = db_result(db_query("SELECT min(weight) FROM {$tablename} WHERE weight>%f {$master_cond}", $weight)); if ($prevweight) { $previd = db_result(db_query("SELECT id FROM {$tablename} WHERE weight=%f {$master_cond}", $prevweight)); db_query("UPDATE {$tablename} SET weight=%f WHERE id=%d {$master_cond}", $prevweight, $id); db_query("UPDATE {$tablename} SET weight=%f WHERE id=%d {$master_cond}", $weight, $previd); } if ($home == 'return!') { return; } redir($home); } if ($action == "del") { db_query("DELETE FROM {$tablename} WHERE id=%d {$master_cond}", $id); } if ($action == "edit") { if (form_post("edit")) { $sets = ""; foreach ($tables[$tablename]['fields'] as $value) { if ($sets) { $sets .= ", "; } if (str_end($value, "_check")) { if (form_post($value)) { $sets .= "{$value}=1"; } else { $sets .= "{$value}=0"; } } else { if (str_end($value, "_time")) { //hms mdy $f = str_start($value, "_time"); $ts = mktime(form_post($f . "_hour"), form_post($f . "_min"), form_post($f . "_sec"), form_post($f . "_month"), form_post($f . "_day"), form_post($f . "_year")); $sets .= "{$value}={$ts}"; } else { $p = form_post($value); $p = SlashSymbolsFix($p); if (mysql || pdo_sqlite) { $p = mysql_real_escape_string($p); } if (sqlite2) { $p = sqlite_escape_string($p); } if (sqlite3) { $p = $GLOBALS['dbhandle']->escapeString($p); } if ($p == "null") { $sets .= "{$value}=null"; } else { $sets .= "{$value} = '" . $p . "' "; } } } } $s = "UPDATE {$tablename} SET {$sets} WHERE id={$id} {$master_cond}"; db_query($s); $callback = "table_" . $tablename . "_edit"; if (function_exists($callback)) { $callback($id); } redir($home); } page_header("Edit {$table_long_alias}"); if (isset($tables[$tablename]['fields'])) { $r = db_object_get($tablename, $id); form_start(); table_edit_form_generate($tablename, $r); form_submit("{~Save changes}", "edit"); form_end(); return form(); } else { return ""; } } if ($action == "add" && $table_edit_props->add_records) { if (form_post("add")) { //fixme: unsecure, sql injection $fields = ""; $values = ""; if (isset($tables[$tablename]['fields'])) { foreach ($tables[$tablename]['fields'] as $field) { if ($fields) { $fields .= ", "; } $fields .= $field; if ($values) { $values .= ", "; } if (str_end($field, "_check")) { if (form_post($field)) { $values .= "1"; } else { $values .= "0"; } } else { if (str_end($field, "_time")) { //hms mdy $f = str_start($field, "_time"); $ts = mktime(form_post($f . "_hour"), form_post($f . "_min"), form_post($f . "_sec"), form_post($f . "_month"), form_post($f . "_day"), form_post($f . "_year")); $values .= "{$ts}"; } else { $p = form_post($field); $p = SlashSymbolsFix($p); if (mysql || pdo_sqlite) { $p = mysql_real_escape_string($p); } else { if (sqlite2) { $p = sqlite_escape_string($p); } else { if (sqlite3) { $p = $GLOBALS['dbhandle']->escapeString($p); } } } if ($p == 'null') { $values .= "null"; } else { $values .= "'" . $p . "'"; } } } } } if ($masterfield) { if ($fields) { $fields .= ", "; } $fields .= " {$masterfield}"; if (strtolower($mastervalue) == 'null') { $values .= ", null "; } else { $values .= ", '{$mastervalue}'"; } } if (isset($tables[$tablename]['weight'])) { if ($fields) { $fields .= ", "; } $fields .= " weight"; $values .= ", " . (db_result(db_query("SELECT max(id) FROM {$tablename}")) + 1); } if ($values && $values[0] == ',') { $values = substr($values, 1, strlen($values)); } db_query("INSERT INTO {$tablename} (id, {$fields}) VALUES (null, {$values})"); $id = db_last_id(); $callback = "table_" . $tablename . "_edit"; if (function_exists($callback)) { $callback($id); } if ($table_edit_props->add_redir) { redir($home); } } page_header("Add {$table_long_alias}"); form_start("", "post", " name=add_form "); table_edit_form_generate($tablename); if ($table_edit_props->add_record_html) { global $form; $form .= "<tr><td><td>" . $table_edit_props->add_record_html; } if ($table_edit_props->add_record_button_show) { form_submit("{~Add record}", "add"); } else { form_hidden("add", "1"); } form_end(); return form(); } if (strlen($GLOBALS['pageheader'] == 0)) { if (!str_end($table_long_alias, "s")) { page_header("{$table_long_alias}" . "s List"); } else { page_header($table_long_alias); } } $ff = array(); $ff = @$tables[$tablename]['fields']; $fields = ""; $joins = "{$tablename}"; $titles = array(); if ($ff) { foreach ($ff as $f) { if ($fields) { $fields .= ", "; } $type = substr($f, strlen($f) - 3, 3); if ($type == "_id") { $cap = substr($f, 0, strlen($f) - 3); $table = $cap . "s"; if (!isset($tables[$table])) { $table = str_prefix($tablename) . $table; } $titlefield = ""; foreach ($tables[$table]['fields'] as $v) { $titlefield = $v; break; } $fields .= " {$table}.{$titlefield} as {$cap} "; $joins .= " LEFT JOIN {$table} ON {$tablename}.{$f} = {$table}.id "; $titles[] = $cap; } else { $fields .= "{$tablename}.{$f}"; $titles[] = $f; } } } $where = ""; if ($masterfield) { if (strtolower($mastervalue) == 'null') { $where = " WHERE {$masterfield} is null "; } else { $where = " WHERE {$masterfield}='{$mastervalue}' "; } } if ($fields) { $fields_s = ", {$fields}"; } else { $fields_s = ""; } $q = "SELECT {$tablename}.id as id {$fields_s} FROM {$joins} {$where} {$order}"; $act = ""; if ($table_edit_props->edit_record_show) { $edit_image = "edit.png"; if ($table_edit_props->use_rename_icon_for_edit) { $edit_image = "rename.png"; } $act .= "<a href=?q={$home}/edit/[id]><img src=images/bios/{$edit_image} border=0></a>"; } if ($table_edit_props->del_record_show) { $act .= "<a href=?q={$home}/del/[id]><img onclick=\"return confirm('{~Are you sure?}');\"src=images/bios/del.png border=0></a>"; } //up down arrows /* if(isset($tables[$tablename]['weight'])) { $act = " <a href=?q=$home/up/[id]><img src=images/up.png></a> <a href=?q=$home/down/[id]><img src=images/down.png></a> ".$act; }*/ $rr = db_query($q); $s = ""; $rr = db_fetch_objects($rr); if (count($rr) == 0) { $s .= "{~no records}<br>"; } else { if ($table_edit_props->action_string_left) { table_start(count($ff) + 2); if ($table_edit_props->col_title_show) { table_add("", " class=table_edit_header "); } } else { table_start(count($ff) + 1); } ///HEADERS if ($table_edit_props->col_title_show) { foreach ($titles as $v) { if (str_end($v, "_check")) { $v = str_start($v, "_check"); } else { if (str_end($v, "_text")) { $v = str_start($v, "_text"); } } table_add("{~{$v}}", " class=table_edit_header "); } table_add("", " class=table_edit_header "); } foreach ($rr as $r) { $r = (array) $r; ////// table add id attribute to tr global $table_row_attributes; $table_row_attributes = " id=" . $r['id'] . " "; /////////////////////////////////////// $acts_left = ""; if ($table_edit_props->action_string_left) { $acts_left = $table_edit_props->action_string_left; $acts_left = str_replace("[id]", $r['id'], $acts_left); table_add($acts_left); } foreach ($r as $key => $value) { if (str_end($key, "_check")) { if ($value == 1) { table_add("<INPUT TYPE=CHECKBOX READONLY readonly='readonly' checked onclick='javascript:return false'>"); } else { table_add("<INPUT TYPE=CHECKBOX READONLY readonly='readonly' onclick='javascript:return false'>"); } } else { if (str_end($key, "_time")) { table_add(@date("Y/m/d H:i:s", $value)); } else { if ($key != 'id') { table_add($value, " class=table_edit_cell "); } } } } $useract = ""; if (function_exists($actionstring)) { $useract = $actionstring($r['id'], $r); } else { $useract = $actionstring; } $acts = str_replace("[id]", $r['id'], $act . " " . $useract); table_add($acts); } $s = ""; $s .= table_flush(" class=table_edit "); /// table drag reorder if (isset($tables[$tablename]['weight']) && $tables[$tablename]['weight']) { $s .= table_edit_drag_code($home); } ///// } if ($table_edit_props->new_record_show && $table_edit_props->add_records) { $html = "<img src=images/bios/add.png border=0> {~Add a new record}"; if ($table_edit_props->new_record_html) { $html = $table_edit_props->new_record_html; } $s .= "<br><a href=?q={$home}/add>{$html}</a>"; } return $s; }
\t</div> \t<div style="width: 50%; float: right; text-align: center; " > \t\t<br> \t\t<span style="white-space: nowrap"> \t\t\t<label for="n_id_g">Groom n_id</label> \t\t\t<input type="text" name="n_id_g" id="n_id_g" value="{$n_id_g}" style="width:100px; min-width: 0;" > \t\t</span> \t\t<span style="white-space: nowrap"> \t\t\t<label for="n_id_b">Bride n_id</label> \t\t\t<input type="text" name="n_id_b" id="n_id_b" value="{$n_id_b}" style="width:100px; min-width: 0; "> \t\t</span> \t</div> </div> <br> EOT; table_start(); $cell[0] = NULL; $cell[1] = 'Groom NSHVS'; $cell[2] = 'Groom Database'; $cell[3] = 'Bride NSHVS'; $cell[4] = 'Bride Database'; table_row_header($cell); $cell[0] = 'Name'; $cell[1] = form_input('groom'); $cell[2] = $pgv_groom->link; $cell[3] = form_input('bride'); $cell[4] = $pgv_bride->link; table_row($cell); $cell[0] = 'Age'; $cell[1] = form_input('groom_age'); $cell[2] = null;
function print_actorresults($results) { table_start('Actor Results'); foreach ($results as $actor) { echo ' <li>', filter_var($actor->getName(), FILTER_SANITIZE_STRING), ' (<a href="https://www.themoviedb.org/person/', $actor->getID(), '">', $actor->getID(), '</a>)</li>'; print "\n"; } 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"; }
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_tasks() { page_head("File transfers"); table_start(); table_header(array("ID", "Created", "File", "Local", "Remote", "Status", "Last error")); $tasks = task_enum(); foreach ($tasks as $task) { $store = store_lookup_id($task->local_store_id); table_row(array($task->id, time_str($task->create_time), $task->file_name, $store->name, $task->remote_site . ': ' . $task->remote_store, task_status($task), $task->last_error . ' (' . time_str($task->last_error_time) . ')')); } table_end(); if (count($tasks) == 0) { echo "No tasks"; } page_tail(); }
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(); }
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 page_report($daysago = 0) { $midnight = @mktime(0, 0, 0, date('n'), @date('j') - $daysago); $rr = db_fetch_objects(db_query("SELECT * FROM log WHERE time_time>{$midnight}")); table_start(6); $state = 0; $total = 0; foreach ($rr as $r) { $next = db_result(db_query("SELECT time_time FROM log WHERE id>{$r->id} ORDER BY id LIMIT 1")); if (!$next) { $next = time(); } $span = round(($next - $r->time_time) / (60 * 60), 2); if ($r->active_check) { table_add("<input class=active_check type=checkbox>"); } else { table_add(""); } table_add(@date("H:i:s", $r->time_time)); table_add($r->memo); table_add($span, " class=span "); $mins = 60 * $span; table_add("hour ({$mins} min)"); $h = $span * 200; if ($r->active_check) { $bg = "#0f0"; } else { $bg = "#ddd"; } table_add("<div style='height:{$h}px;background:{$bg};'> </div>"); if ($r->active_check) { $total += $span; } } $o = table(); $total_min = 60 * $total; $o .= "total: {$total} ({$total_min} min)<br>"; $o .= "checked total: <span id=checked_total></span>"; return $o; }
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_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 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 broadcast_msg() { global $uid; global $PHP_SELF; // check ob im parlament $sth = mysql_query("select 1 from alliance where leader = {$uid} or devminister = {$uid} or forminister = {$uid} or milminister = {$uid}"); if (!$sth) { show_error("ERR::BROADCAST MSG"); return false; } if (mysql_num_rows($sth) == 0) { show_message("You can't broadcast, since you're not in the parliament."); return false; } else { table_start("center", "500"); table_text(array("Broadcast"), "left", "", "2", "smallhead"); echo "<form action=\"" . $PHP_SELF . "\" method=post>"; table_form_text("Message (max 255)", "message", "", "50", "255", "text"); table_form_submit("Broadcast", "proc_broadcast", "0"); echo "</form><br><br>"; } }
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(); }