function planet_production_change() { global $db; global $res; global $playerinfo; global $dbtables; global $username; global $sort; global $query; global $color_header, $color, $color_line1, $color_line2; global $l_pr_teamlink, $l_pr_clicktosort; global $l_sector, $l_name, $l_unnamed, $l_ore, $l_organics, $l_goods, $l_energy, $l_colonists, $l_credits, $l_fighters, $l_torps, $l_base, $l_selling, $l_pr_totals, $l_yes, $l_no; $query = "SELECT * FROM $dbtables[planets] WHERE owner=$playerinfo[player_id] AND base='Y'"; echo "Planetary report <B><A HREF=planet-report.php?PRepType=0>menu</A></B><BR>" . "<BR>" . "<B><A HREF=planet-report.php?PRepType=1>Planet Status</A></B><BR>"; echo "<br><B><A HREF=planet-report.php?PRepType=3>Set Planet Commodity Sale Prices</A></B><BR>"; if ($playerinfo[team]>0) { echo "<BR>" . "<B><A HREF=alliance-planets.php>$l_pr_teamlink</A></B><BR> " . "<BR>"; } if(!empty($sort)) { $query .= " ORDER BY"; if($sort == "name") { $query .= " $sort ASC"; } elseif($sort == "organics" || $sort == "ore" || $sort == "goods" || $sort == "energy" || $sort == "fighters") { $query .= " prod_$sort DESC, sector_id ASC"; } elseif($sort == "colonists" || $sort == "credits") { $query .= " $sort DESC, sector_id ASC"; } elseif($sort == "torp") { $query .= " prod_torp DESC, sector_id ASC"; } elseif($sort == "piq") { $query .= " tech_level DESC, sector_id ASC"; } else { $query .= " sector_id ASC"; } } else { $query .= " ORDER BY sector_id ASC"; } $res = $db->Execute($query); $i = 0; if($res) { while(!$res->EOF) { $planet[$i] = $res->fields; $i++; $res->MoveNext(); } } $num_planets = $i; if($num_planets < 1) { echo "<BR>$l_pr_noplanet"; } else { echo "<FORM ACTION=planet-report-CE.php METHOD=POST>"; // ------ next block of echo's creates the header of the table echo "$l_pr_clicktosort<BR><BR>"; echo "<TABLE WIDTH=\"100%\" BORDER=1 CELLSPACING=0 CELLPADDING=0>"; echo "<TR BGCOLOR=\"$color_header\" VALIGN=BOTTOM>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=sector_id>Sector</A><BR>"; echo "<A HREF=planet-report.php?PRepType=2&sort=name>Planet</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=ore>$l_ore</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=organics>Orgs</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=goods>$l_goods</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=energy>NRG</A></FONT></TD>"; echo "</TR>"; $total_colonists = 0; $total_credits = 0; $total_corp = 0; $temp_var = 0; $color = $color_line1; for($i=0; $i<$num_planets; $i++) { if(empty($planet[$i][name])) { $planet[$i][name] = $l_unnamed; } echo "<TR BGCOLOR=\"$color\">"; echo "<TD ALIGN=CENTER><A HREF=rsmove.php?engage=1&destination=". $planet[$i][sector_id] . ">". $planet[$i][sector_id] ."</A><BR>". $planet[$i][name] . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_ore[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_ore"] . "\">" . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_organics[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_organics"] . "\">" . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_goods[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_goods"] . "\">" . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_energy[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_energy"] . "\">" . "</TD>"; echo "</TR>"; if($color == $color_line1) { $color = $color_line2; } else { $color = $color_line1; } } echo "</TABLE><br>"; echo "<TABLE WIDTH=\"100%\" BORDER=1 CELLSPACING=0 CELLPADDING=0>"; echo "<TR BGCOLOR=\"$color_header\" VALIGN=BOTTOM>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=sector_id>Sector</A></FONT><br>"; echo "<A HREF=planet-report.php?PRepType=2&sort=name>$l_name</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=colonists>Pops</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=credits>Creds</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=fighters>$l_fighters</A></FONT></TD>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=torp>Torps</A></FONT></TD>"; echo "</TR>"; $color = $color_line1; for($i=0; $i<$num_planets; $i++) { $total_colonists += $planet[$i][colonists]; $total_credits += $planet[$i][credits]; if(empty($planet[$i][name])) { $planet[$i][name] = $l_unnamed; } echo "<TR BGCOLOR=\"$color\">"; echo "<TD ALIGN=CENTER><A HREF=rsmove.php?engage=1&destination=". $planet[$i][sector_id] . ">". $planet[$i][sector_id] ."</A><br>"; echo $planet[$i][name] . "</TD>"; echo "<TD ALIGN=CENTER>" . NUMBER($planet[$i][colonists]) . "</TD>"; echo "<TD ALIGN=CENTER>" . NUMBER($planet[$i][credits]) . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_fighters[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_fighters"] . "\">" . "</TD>"; echo "<TD ALIGN=CENTER>" . "<input size=2 type=text name=\"prod_torp[" . $planet[$i]["planet_id"] . "]\" value=\"" . $planet[$i]["prod_torp"] . "\">" . "</TD>"; echo "</TR>"; if($color == $color_line1) { $color = $color_line2; } else { $color = $color_line1; } } echo "<TR BGCOLOR=$color>"; echo "<TD ALIGN=CENTER>$l_pr_totals</TD>"; echo "<TD ALIGN=CENTER>" . NUMBER($total_colonists) . "</TD>"; echo "<TD ALIGN=CENTER>" . NUMBER($total_credits) . "</TD>"; echo "<TD>" . "" . "</TD>"; echo "<TD>" . "" . "</TD>"; echo "</TR>"; echo "</TABLE><br>"; echo "<TABLE WIDTH=\"100%\" BORDER=1 CELLSPACING=0 CELLPADDING=2>"; echo "<TR BGCOLOR=\"$color_header\" VALIGN=BOTTOM>"; echo "<TD ALIGN=CENTER><A HREF=planet-report.php?PRepType=2&sort=sector_id>Sector</A></FONT><br>"; echo "<A HREF=planet-report.php?PRepType=2&sort=name>$l_name</A></FONT></TD>"; if($playerinfo[team] > 0) echo "<TD ALIGN=CENTER>Alliance<br>Planet?</TD>"; echo "<TD ALIGN=CENTER>$l_selling?</TD>"; echo "<TD ALIGN=CENTER>Planet IQ</TD>"; echo "</TR>"; $color = $color_line1; for($i=0; $i<$num_planets; $i++) { if(empty($planet[$i][name])) { $planet[$i][name] = $l_unnamed; } echo "<TR BGCOLOR=\"$color\">"; echo "<TD ALIGN=CENTER><A HREF=rsmove.php?engage=1&destination=". $planet[$i][sector_id] . ">". $planet[$i][sector_id] ."</A><br>"; echo $planet[$i][name] . "</TD>"; if($playerinfo[team] > 0) echo "<TD ALIGN=CENTER>" . corp_planet_checkboxes($planet, $i) . "</TD>"; echo "<TD ALIGN=CENTER>" . selling_checkboxes($planet, $i) . "</TD>"; echo "<TD ALIGN=CENTER>" . NUMBER($planet[$i][tech_level]) . "</TD>"; echo "</TR>"; if($color == $color_line1) { $color = $color_line2; } else { $color = $color_line1; } } echo "</TABLE>"; echo "<BR>"; echo "<INPUT TYPE=HIDDEN NAME=player_id VALUE=$playerinfo[player_id]>"; echo "<INPUT TYPE=HIDDEN NAME=team_id VALUE=$playerinfo[team]>"; echo "<INPUT TYPE=SUBMIT VALUE=Submit> <INPUT TYPE=RESET VALUE=Reset>"; echo "</FORM>"; } }
function planet_production_change() { global $db, $db_logging; global $res; global $playerinfo; global $username; global $sort; global $query; global $color_header, $color, $color_line1, $color_line2; global $l_pr_teamlink, $l_pr_clicktosort; global $l_pr_noplanet; global $l_sector, $l_name, $l_unnamed, $l_ore, $l_organics, $l_goods, $l_energy, $l_colonists, $l_credits, $l_fighters; global $l_torps, $l_base, $l_selling, $l_pr_totals, $l_yes, $l_no; $query = "SELECT * FROM {$db->prefix}planets WHERE owner=? AND base='Y'"; echo "<div style='width:100%; margin:auto; font-size:14px;'>\n"; echo "Planetary report <strong><a href=\"planet_report.php?PRepType=0\">menu</a></strong><br><br>" . "<strong><a href=\"planet_report.php?PRepType=1\">Planet Status</a></strong><br>"; if ($playerinfo['team'] > 0) { echo "<br><strong><a href=team_planets.php>{$l_pr_teamlink}</a></strong><br> <br>"; } if (!empty($sort)) { $query .= " ORDER BY"; if ($sort == "name") { $query .= " {$sort} ASC"; } elseif ($sort == "organics" || $sort == "ore" || $sort == "goods" || $sort == "energy" || $sort == "fighters") { $query .= " prod_{$sort} DESC, sector_id ASC"; } elseif ($sort == "colonists" || $sort == "credits") { $query .= " {$sort} DESC, sector_id ASC"; } elseif ($sort == "torp") { $query .= " prod_torp DESC, sector_id ASC"; } else { $query .= " sector_id ASC"; } } else { $query .= " ORDER BY sector_id ASC"; } $res = $db->Execute($query, array($playerinfo['ship_id'])); db_op_result($db, $res, __LINE__, __FILE__, $db_logging); $i = 0; if ($res) { while (!$res->EOF) { $planet[$i] = $res->fields; $i++; $res->MoveNext(); } } $num_planets = $i; if ($num_planets < 1) { echo "<br>{$l_pr_noplanet}"; } else { echo "<form action='planet_report_ce.php' method='post'>\n"; // Next block of echo's creates the header of the table /* Start table */ ?> <div class="planet-table-container"> <?php echo "<table><tbody>"; echo "<tr>"; echo "<td><a href='planet_report.php?PRepType=2&sort=sector_id'>{$l_sector}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=name'>{$l_name}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=ore'>{$l_ore}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=organics'>{$l_organics}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=goods'>{$l_goods}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=energy'>{$l_energy}</a></td>"; echo "<td> <a href='planet_report.php?PRepType=2&sort=colonists'>{$l_colonists}</a></td>"; echo "<td> <a href='planet_report.php?PRepType=2&sort=credits'>{$l_credits}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=fighters'>{$l_fighters}</a></td>"; echo "<td><a href='planet_report.php?PRepType=2&sort=torp'>{$l_torps}</a></td>"; if ($playerinfo['team'] > 0) { echo "<td>Corp?</strong></td>"; } echo "<td>{$l_selling}?</strong></td>"; echo "</tr>"; $total_colonists = 0; $total_credits = 0; $total_corp = 0; $temp_var = 0; for ($i = 0; $i < $num_planets; $i++) { $total_colonists += $planet[$i]['colonists']; $total_credits += $planet[$i]['credits']; if (empty($planet[$i]['name'])) { $planet[$i]['name'] = $l_unnamed; } echo "<tr>"; echo "<td><a href=rsmove.php?engage=1&destination=" . $planet[$i]['sector_id'] . ">" . $planet[$i]['sector_id'] . "</a></td>"; echo "<td>" . $planet[$i]['name'] . "</td>"; echo "<td>" . "<input size=6 type=text name=\"prod_ore[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_ore'] . "\">" . "</td>"; echo "<td>" . "<input size=6 type=text name=\"prod_organics[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_organics'] . "\">" . "</td>"; echo "<td>" . "<input size=6 type=text name=\"prod_goods[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_goods'] . "\">" . "</td>"; echo "<td>" . "<input size=6 type=text name=\"prod_energy[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_energy'] . "\">" . "</td>"; echo "<td>" . NUMBER($planet[$i]['colonists']) . "</td>"; echo "<td><span class='table_word_gold'>" . NUMBER($planet[$i]['credits']) . "</span></td>"; echo "<td>" . "<input size=6 type=text name=\"prod_fighters[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_fighters'] . "\">" . "</td>"; echo "<td>" . "<input size=6 type=text name=\"prod_torp[" . $planet[$i]['planet_id'] . "]\" value=\"" . $planet[$i]['prod_torp'] . "\">" . "</td>"; if ($playerinfo['team'] > 0) { echo "<td>" . corp_planet_checkboxes($planet, $i) . "</td>"; } echo "<td align=center>" . selling_checkboxes($planet, $i) . "</td>"; echo "</tr>"; } echo "<tr>"; echo "<td colspan='2'><span class='table_word_faded'>Totals:</span></td>"; echo "<td colspan='4'>" . "" . "</td>"; echo "<td>" . NUMBER($total_colonists) . "</td>"; echo "<td><span class='table_word_yellow'>" . NUMBER($total_credits) . "</span></td>"; if ($playerinfo['team'] > 0) { echo "<td colspan='4'></td>"; } else { echo "<td colspan='3'></td>"; } echo "</tr>"; echo "</tbody></table>"; ?> </div> <?php /*End table*/ echo "<br>\n"; echo "<input type=hidden name=ship_id value={$playerinfo['ship_id']}>\n"; echo "<input type=hidden name=team_id value={$playerinfo['team']}>\n"; echo "<input type=submit value=submit> <input type=reset value=reset>\n"; echo "</form>\n"; } echo "</div>\n"; }