<?	
include ('logue.php'); 
include ('entete2.php');
include ('entete.php');
include ('ressource.php');
include ('chantiercalcul.php');

$sql2 = "SELECT robo_lvl,chantier_lvl,hangarfer_lvl,hangarfer_evolution,hangaror_lvl,hangaror_evolution,hangarada_lvl,hangarada_evolution,hangaror_lvl,hangarura_lvl,hangarura_evolution,labo_lvl,labo_evolution,fer_energie,or_energie,ada_energie,ura_energie,exfer_energie,exor_energie,central_energie FROM matgraph_users WHERE id='$planete' ";
$res2 = mysql_query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 

$pts = floor(($row[pts] / 1000)) ;
$Total_energie_consom = $row[fer_energie] + $row[or_energie] + $row[exfer_energie] + $row[exor_energie] + $row[ada_energie] + $row[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, ',', ' ');

echo"
<style>
input {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
textarea {
border:1px solid #7E7E7E;
background-color:#000000;
font-family:'trebuchet ms',sans-serif;
color:white;
}
select, option {
background-color:#000000;
color:white;
}
</style>
<STYLE TYPE=text/css>
.Style1 {color: #0000FF}
.Style2 {color: #FF0000}
</STYLE>";
 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\" rowspan=\"2\" valign=\"middle\">
       <div align=\"center\">
         <input name=\"page\" value=\"galaxi1\" type=\"hidden\" id=\"page\">
         <select name=\"idcolo\" onchange=submit()>";
include ('colo2.php'); 
$galaxi2 = $_POST["galaxi2"];
$system22 = $_POST["system2"];

$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '1'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {
$sql1 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '1'";
$res1 = mysql_query($sql1)or die('erreur sql<br>'.$sql1.'<br>'.mysql_error());
$row1 = mysql_fetch_array($res1); 
$plan1 = "$row1[planete] ($row1[login])";
$msg1 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan1 = "libre" ; $msg1 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '2'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql2 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '2'";
$res2 = mysql_query($sql2)or die('erreur sql<br>'.$sql2.'<br>'.mysql_error());
$row2 = mysql_fetch_array($res2); 
$plan2 = "$row2[planete] ($row2[login])" ;
$msg2 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan2 = "libre" ; $msg2 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '3'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql3 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '3'";
$res3 = mysql_query($sql3)or die('erreur sql<br>'.$sql3.'<br>'.mysql_error());
$row3 = mysql_fetch_array($res3); 
$plan3 = "$row3[planete] ($row3[login])" ;
$msg3 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan3 = "libre" ; $msg3 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '4'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql4 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '4'";
$res4 = mysql_query($sql4)or die('erreur sql<br>'.$sql4.'<br>'.mysql_error());
$row4 = mysql_fetch_array($res4); 
$plan4 = "$row4[planete] ($row4[login])" ;
$msg4 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan4 = "libre" ; $msg4 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '5'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql5 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '5'";
$res5 = mysql_query($sql5)or die('erreur sql<br>'.$sql5.'<br>'.mysql_error());
$row5 = mysql_fetch_array($res5); 
$plan5 = "$row5[planete] ($row5[login])" ;
$msg5 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan5 = "libre" ; $msg5 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '6'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql6 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '6'";
$res6 = mysql_query($sql6)or die('erreur sql<br>'.$sql6.'<br>'.mysql_error());
$row6 = mysql_fetch_array($res6); 
$plan6 = "$row6[planete] ($row6[login])" ;
$msg6 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan6 = "libre" ; $msg6 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '7'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql7 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '7'";
$res7 = mysql_query($sql7)or die('erreur sql<br>'.$sql7.'<br>'.mysql_error());
$row7 = mysql_fetch_array($res7); 
$plan7 = "$row7[planete] ($row7[login])" ;
$msg7 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan7 = "libre" ; $msg7 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '8'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql8 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '8'";
$res8 = mysql_query($sql8)or die('erreur sql<br>'.$sql8.'<br>'.mysql_error());
$row8 = mysql_fetch_array($res8); 
$plan8 = "$row8[planete] ($row8[login])" ;
$msg8 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan8 = "libre" ; $msg8 = "&nbsp;"; }
$req = "SELECT galaxi,system FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '9'";
$res = mysql_query($req);
$num = mysql_num_rows($res);
if ($num >0) {

$sql9 = "SELECT id,login,planete FROM matgraph_users WHERE galaxi='$galaxi2' AND system = '$system2' AND position= '9'";
$res9 = mysql_query($sql9)or die('erreur sql<br>'.$sql9.'<br>'.mysql_error());
$row9 = mysql_fetch_array($res9); 
$plan9 = "$row9[planete] ($row9[login])" ;
$msg9 = "<input type=\"image\" src=\"imgs/msg.gif\">";
} else { $plan9 = "libre" ; $msg9 = "&nbsp;"; }

$prochgalaxi = $galaxi2 +1;
echo"<br><form name=\"galaxi\" method=\"post\" action=\"galaxi1.php\" target=\"_parent\"><div align=\"center\">
  <table width=\"347\" border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"5\">
    <tr>
      <td align=\"center\" width=\"97\">Galaxie : </td>
      <td align=\"center\" width=\"97\">Système Solaire :</td>
    </tr>
    <tr>
      <td align=\"center\">
        <input name=\"galaxi2\" type=\"text\" value=\"$galaxi2\" size=\"4\" maxlength=\"2\">
      </td>
      <td align=\"center\">
        <input name=\"system2\" type=\"text\" value=\"$system2\" size=\"4\" maxlength=\"3\">
      </td>
    </tr>
    <tr>
      <td colspan=\"2\"><div align=\"center\">
        <input type=\"submit\" name=\"Submit\" value=\"Voir\"></form>
      </div></td>
      </tr>
  </table><br><br><br>
<table width=\"560\"  border=\"1\" align=\"center\" cellpadding=\"0\" cellspacing=\"0\">
  <tr>
    <td width=\"20\"><div align=\"center\">1</div></td>
    <td width=\"382\"><div align=\"center\">$plan1</div></td>
    <form name=\"galaxi1\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td width=\"150\"><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row1[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row1[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$row[system]\">
  <input name=\"position\" type=\"hidden\" value=\"1\">
  $msg1</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">2</div></td>
    <td><div align=\"center\">$plan2</div></td>
    <form name=\"galaxi2\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row2[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row2[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"2\">
  $msg2</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">3</div></td>
    <td><div align=\"center\">$plan3</div></td>
    <form name=\"galaxi3\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row3[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row3[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"3\">
  $msg3</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">4</div></td>
    <td><div align=\"center\">$plan4</div></td>
    <form name=\"galaxi4\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row4[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row4[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"4\">
  $msg4</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">5</div></td>
    <td><div align=\"center\">$plan5</div></td>
    <form name=\"galaxi5\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row5[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row5[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"5\">
  $msg5</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">6</div></td>
    <td><div align=\"center\">$plan6</div></td>
    <form name=\"galaxi6\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row6[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row6[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"6\">
  $msg6</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">7</div></td>
    <td><div align=\"center\">$plan7</div></td>
    <form name=\"galaxi7\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row7[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row7[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"7\">
  $msg7</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">8</div></td>
    <td><div align=\"center\">$plan8</div></td>
    <form name=\"galaxi8\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row8[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row8[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"8\">
  $msg8</div></td></form>
  </tr>
  <tr>
    <td><div align=\"center\">9</div></td>
    <td><div align=\"center\">$plan9</div></td>
    <form name=\"galaxi9\" method=\"post\" action=\"mp_envoi.php\" target=\"_parent\"><td><div align=\"center\">
  <input name=\"idreceveur\" type=\"hidden\" value=\"$row9[id]\">
  <input name=\"loginreceveur\" type=\"hidden\" value=\"$row9[login]\">
  <input name=\"galaxi\" type=\"hidden\" value=\"$galaxi2\">
  <input name=\"system\" type=\"hidden\" value=\"$system2\">
  <input name=\"position\" type=\"hidden\" value=\"9\">
  $msg9</div></td></form>
  </tr>
</table></div>";
?>

