<?php
$sqlenergie = "SELECT exfer_energie,exor_energie,fer_energie,or_energie,ada_energie,ura_energie FROM matgraph_users WHERE id='$planete' ";
$resenergie = db_mysql_Query($sqlenergie)or die('erreur sql<br>'.$sqlenergie.'<br>'.mysql_error());
$rowenergie = mysql_fetch_array($resenergie); 
$Total_energie_consom = $rowenergie[fer_energie] + $rowenergie[or_energie] + $rowenergie[exfer_energie] + $rowenergie[exor_energie] + $rowenergie[ada_energie] + $rowenergie[ura_energie] ;
$Total_energie_reste =  round(($New_central_energie + $New_fission_energie + $Total_energie_consom),0);
$Total_energie_prod = round(($New_central_energie + $New_fission_energie),0);
$Total_energie_reste2 =  number_format(round(($New_central_energie + $New_fission_energie + $Total_energie_consom),0), 0, ',', ' ');
$Total_energie_prod2 = number_format(round(($New_central_energie + $New_fission_energie),0), 0, ',', ' ');
$sqlhangar = "SELECT hangarfer_lvl,hangaror_lvl,hangarada_lvl,hangarura_lvl FROM matgraph_users WHERE id='$planete' ";
$reshangar  = db_mysql_Query($sqlhangar )or die('erreur sql<br>'.$sqlhangar .'<br>'.mysql_error());
$rowhangar  = mysql_fetch_array($reshangar ); 
 echo"<div align=\"center\"><form name=\"colo\" method=\"post\" action=\"colonies.php\" target=\"_parent\">
<table align=\"center\" border=\"0\" cellspacing=\"0\" cellpadding=\"0\">
   <tr>
     <td width=\"100\"  valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"batiments\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
$sqlp = "SELECT planete FROM matgraph_idjoueur WHERE idjoueur='$idlogin' ";
$resp = db_mysql_Query($sqlp)or die('erreur sql<br>'.$sqlp.'<br>'.mysql_error());
$rowp = mysql_fetch_array($resp); 
$sqlp2 = "SELECT planete,galaxi,system,position FROM matgraph_users WHERE id='$rowp[planete]' ";
$resp2 = db_mysql_Query($sqlp2)or die('erreur sql<br>'.$sqlp2.'<br>'.mysql_error());
$rowp2 = mysql_fetch_array($resp2); 
echo"<option value=\"$rowp[planete]\">$rowp2[planete]&nbsp;&nbsp;[$rowp2[galaxi]:$rowp2[system]:$rowp2[position]]</option>";
$reqcolo = "SELECT id,idjoueur,planete,galaxi,system,position FROM matgraph_users WHERE idjoueur='$idlogin' ";
$rescolo = db_mysql_Query($reqcolo) or die('erreur sql<br>'.$reqcolo.'<br>'.mysql_error());
$numcolo = mysql_num_rows($rescolo);
if ($numcolo >0) {
While ( $rowcolo = mysql_fetch_array($rescolo) ) {
if ($rowcolo[id]!=$rowp[planete]) {
echo"<option value=\"$rowcolo[id]\">$rowcolo[planete]&nbsp;&nbsp;[$rowcolo[galaxi]:$rowcolo[system]:$rowcolo[position]]</option>";
}}}
echo"</select>
       </div>       <div align=\"center\">
       </div></td>
       <td></td>
     <td width=\"70\"><div align=\"center\">Fer :</div></td>
     <td width=\"70\"><div align=\"center\">Or : </div></td>
     <td width=\"70\"><div align=\"center\">Cristal : </div></td>
     <td width=\"70\"><div align=\"center\">Naquadah : </div></td>
     <td width=\"90\"><div align=\"center\">Energie : </div></td>
   </tr>
   <tr>";
   if ($newwfer_ressource > (100000 *(bcpow(1.5, $rowhangar[hangarfer_lvl],3)))){
     echo"<td><div align=\"center\"><p class=\"Style2\">$neww3fer_ressource </p></div></td>"; }
	 else {echo"<td><div align=\"center\">$neww3fer_ressource </div></td>"; }
   if ($newwor_ressource > (100000 *(bcpow(1.5, $rowhangar[hangaror_lvl],3)))){
     echo"<td><div align=\"center\"><p class=\"Style2\">$neww3or_ressource </p></div></td>"; }
	 else {echo"<td><div align=\"center\">$neww3or_ressource </div></td>"; }
   if ($newwada_ressource > (100000 *(bcpow(1.5, $rowhangar[hangarada_lvl],3)))){
     echo"<td><div align=\"center\"><p class=\"Style2\">$neww3ada_ressource </p></div></td>"; }
	 else {echo"<td><div align=\"center\">$neww3ada_ressource </div></td>"; }
   if ($newwura_ressource > (100000 *(bcpow(1.5, $rowhangar[hangarura_lvl],3)))){
     echo"<td><div align=\"center\"><p class=\"Style2\">$neww3ura_ressource </p></div></td>"; }
	 else {echo"<td><div align=\"center\">$neww3ura_ressource </div></td>"; }
     echo"<td><div align=\"center\">$Total_energie_reste / $Total_energie_prod</div></td>
   </tr>
 </table></form>";
?>
