include_once('mapcfg.php'); echo (""); echo ("
"); if ($usecss == 1){ echo (""); echo (""); echo (""); } echo ("");
$control = array();
$econ = array();
$link = mysql_connect($D2dbhostname .":" .$D2dbport, $D2dbuser, $D2dbpass);
mysql_select_db($D2db);
$query = "SELECT PoliticalControl,CurrentEconomicPoints FROM maphex";
$result = mysql_query($query);
$a=0;
while ($line = mysql_fetch_array($result, MYSQL_ASSOC)) {
$control[$a] = $line['PoliticalControl'];
$econ[$a] = $line['CurrentEconomicPoints'];
$a=$a+1;
}
mysql_free_result($result);
mysql_close($link);
$empstring = array();
$empstring[0] = "United Federation of Planets";
$empstring[1] = "Klingon Empire";
$empstring[2] = "Romulan Star Empire";
$empstring[3] = "Lyran Star Empire";
$empstring[4] = "Hydran Kingdom";
$empstring[5] = "Gorn Confederacy";
$empstring[6] = "Interstellar Concordium";
$empstring[7] = "Kzinti Hegemony";
$empstring[8] = "Orion Pirate Cartels";
$empstring[9] = "Space Monster";
$empstring[15] = "Contested Sector";
$empecon = array();
$empecon[0] = 0;
$empecon[1] = 0;
$empecon[2] = 0;
$empecon[3] = 0;
$empecon[4] = 0;
$empecon[5] = 0;
$empecon[6] = 0;
$empecon[7] = 0;
$empecon[8] = 0;
$empecon[9] = 0;
$empecon[15] = 0;
$empcolor = array($empstring[0] => "#0000FF",
$empstring[1] => "#FF0000",
$empstring[2] => "#00FF00",
$empstring[3] => "#FFCC33",
$empstring[4] => "#660099",
$empstring[5] => "#996600",
$empstring[6] => "#FF66CC",
$empstring[7] => "#00FFFF",
$empstring[8] => "#CCCCCC",
$empstring[9] => "#CCCCCC",
$empstring[15] => "#CCCCCC");
$combo1 = array();
$combo2 = array();
$r=0;
for ($i = 0; $i <= $a-1; $i++) {
if($control[$i] == 0) {
$empecon[0] = $empecon[0] + $econ[$i];
}
if($control[$i] == 1) {
$empecon[1] = $empecon[1] + $econ[$i];
}
if($control[$i] == 2) {
$empecon[2] = $empecon[2] + $econ[$i];
}
if($control[$i] == 3) {
$empecon[3] = $empecon[3] + $econ[$i];
}
if($control[$i] == 4) {
$empecon[4] = $empecon[4] + $econ[$i];
}
if($control[$i] == 5) {
$empecon[5] = $empecon[5] + $econ[$i];
}
if($control[$i] == 6) {
$empecon[6] = $empecon[6] + $econ[$i];
}
if($control[$i] == 7) {
$empecon[7] = $empecon[7] + $econ[$i];
}
if($control[$i] == 8) {
$empecon[8] = $empecon[8] + $econ[$i];
}
if($control[$i] == 9) {
$empecon[9] = $empecon[9] + $econ[$i];
}
if($control[$i] == 15) {
$empecon[15] = $empecon[15] + $econ[$i];
}
}
for ($j = 0; $j <= 15; $j++) {
if($j <=9 or $j >=15) {
$combo1 = array($empstring[$j]=>$empecon[$j]);
$combo2 = array_merge ($combo2 , $combo1);
}
}
arsort ($combo2);
reset ($combo2);
echo (" "); while (list ($key, $val) = each ($combo2)) { echo ("The "); for ($k = 0; $k <= 15; $k++) { if($k <=9 or $k >=15) { if($key == $empstring[$k]) { echo ""; } } } echo $key; echo ""; echo (" ranks at "); echo $r+1; echo (" with "); echo $val; echo (" total economic points."); echo (" "); $r=$r+1; } echo (" | ");
echo ("