HB/pages/chantier_spatial.php

196 lines
9.1 KiB
PHP

<? session_start(); ?>
<html>
<head>
<title>Space battleship</title>
<link rel="stylesheet" media="screen" name="design" href="design/design.css">
<?php
$id=$_SESSION['id'];
$galaxy=$_SESSION['galaxy'];
$ss=$_SESSION['ss'];
$pos=$_SESSION['pos'];
include 'ressource.php';
include 'bdd.php';
include 'ajout_vaisseaux.php';
function sec ($time) {
$output = '';
$tab = array ('jour' => '86400', 'heure' => '3600', 'minute' => '60', 'seconde' => '1');
foreach ($tab as $key => $value) {
$compteur = 0;
while ($time > ($value-1)) {
$time = $time - $value;
$compteur++;
}
if ($compteur != 0) {
$output .= $compteur.' '.$key;
if ($compteur > 1) $output .= 's';
if ($value != 1) $output .= ' ';
}
}
echo $output;
}
$f = ceil((1080 - (0.1*$chantier_spatial*1080)));
$g = ceil((6300 - (0.1*$chantier_spatial*6300)));
$h = ceil((8280 - (0.1*$chantier_spatial*8280)));
$i = ceil((1440 - (0.1*$chantier_spatial*1440)));
$j = ceil((7380 - (0.1*$chantier_spatial*7380)));
$k = ceil((1200 - (0.1*$chantier_spatial*1200)));
$l = ceil((4680 - (0.1*$chantier_spatial*4680)));
$m = ceil((16800 - (0.1*$chantier_spatial*16800)));
$n = ceil((18060 - (0.1*$chantier_spatial*18060)));
$p = ceil((32400 - (0.1*$chantier_spatial*32400)));
$q = ceil((117000 - (0.1*$chantier_spatial*117000)));
if ($temps_spatial>0) {
switch ($unit_s) {
case 1:
$unit= "transporteurs"; break;
case 2:
$unit= "grand transporteurs"; break;
case 3:
$unit= "vaisseaux de colo"; break;
case 4:
$unit= "sondes"; break;
case 5:
$unit= "recycleurs"; break;
case 6:
$unit= "seraphs"; break;
case 7:
$unit= "frégates"; break;
case 8:
$unit= "croiseurs de classe CCS"; break;
case 9:
$unit= "croiseurs de classe Reverence"; break;
case 10:
$unit= "porte vaisseaux"; break;
case 11:
$unit= "stations orbitale"; break;
}}
?>
<script language="javascript" src="time.js"></script>
</head>
<body>
<? if ($chantier_spatial > 0) {
if ($temps_spatial >0) {
echo "<table align=center><tr><td>
Construction terminé dans : ";
$tr=$temps_spatial-time();
echo '<div id="axion"></div>';
echo '<script language="JavaScript">reste('.$tr.');</script>';
echo "</td></tr><tr><td>Construction de : ".$cons_spatial." ".$unit."</td></tr>
</table>";} else {}
echo"<table align=center>
<tr><td width=150>lmages</td><td width=350>Description</td><td width=120>Nombre</td></tr>";
if ($chantier_spatial >= 1 && $reacteur >= 4) {
echo "<form method=post action=validation_transporteur.php>
<tr>
<td><img src=images/ ></td>
<td align=left>Transporteur ( ".$transporteur." vaisseaux )<br>Métal : 1000<br>Cristal : 800<br>Temps : "; sec($f); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_transporteur /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 5 && $reacteur_f >= 2) {
echo "<form method=post action=validation_gtransporteur.php>
<tr>
<td><img src= ></td>
<td align=left>Grand transporteur ( ".$gtransporteur." vaisseaux )<br>Métal : 4000<br>Cristal : 3000<br>Temps : "; sec($g); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_gtransporteur /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 5 && $reacteur_ff >= 1) {
echo "<form method=post action=validation_vcolo.php>
<tr>
<td><img src=images/vcolo.jpg ></td>
<td align=left>Vaisseau de colonisation ( ".$vcolo." vaisseaux )<br>Métal : 9000<br>Cristal : 9000<br>Hydrogène : 1000<br>Temps : "; sec($h); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_vcolo /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 3 && $reacteur >= 5 && $detection >=2) {
echo "<form method=post action=validation_sonde.php>
<tr>
<td><img src= ></td>
<td align=left>Sonde d'espionnage ( ".$sonde." vaisseaux )<br>Métal : 1000<br>Cristal : 1200<br>Hydrogène : 100<br>Temps : "; sec($i); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_sonde /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 5 && $reacteur_f >= 4 && $blindage >= 5) {
echo "<form method=post action=validation_recycleur.php>
<tr>
<td><img src= ></td>
<td align=left>Recycleur ( ".$recycleur." vaisseaux )<br>Métal : 15000<br>Cristal : 9000<br>Hydrogène : 1000<br>Temps : "; sec($j); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_recycleur /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 1 && $reacteur >= 4) {
echo "<form method=post action=validation_chasseur.php>
<tr>
<td><img src=images/seraph.jpg ></td>
<td align=left>Seraph ( ".$chasseur." vaisseaux )<br>Métal : 1700<br>Cristal : 1220<br>Temps : "; sec($k); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_chasseur /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 3 && $reacteur_f >= 3 && $armement >=1) {
echo "<form method=post action=validation_fregate.php>
<tr>
<td><img src=images/fregate.jpg ></td>
<td align=left>Frégate ( ".$fregate." vaisseaux )<br>Métal : 5800<br>Cristal : 1400<br>Temps : "; sec($l); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_fregate /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 6 && $reacteur_ff >= 2 && $armement >=3 && $blindage >= 4) {
echo "<form method=post action=validation_croiseur.php>
<tr>
<td><img src=images/croiseur1.jpg ></td>
<td align=left>Croiseur de classe CCS ( ".$croiseur." vaisseaux )<br>Métal : 20000<br>Cristal : 16000<br>Hydrogène : 1600<br>Temps : "; sec($m); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_croiseur /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 6 && $reacteur_ff >= 3 && $armement >=4 && $blindage >= 4) {
echo "<form method=post action=validation_croiseur2.php>
<tr>
<td><img src=images/croiseur2.jpg ></td>
<td align=left>Croiseur de classe Reverence ( ".$croiseur2." vaisseaux )<br>Métal : 26000<br>Cristal : 16400<br>Hydrogène : 1600<br>Temps : "; sec($n); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_croiseur2 /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 8 && $reacteur_ff >= 5 && $armement >=6 && $blindage >= 6) {
echo "<form method=post action=validation_pv.php>
<tr>
<td><img src= ></td>
<td align=left>Porte vaisseaux ( ".$pv." vaisseaux )<br>Métal : 60000<br>Cristal : 40000<br>Hydrogène : 3000<br>Temps : "; sec($p); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_pv /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
if ($chantier_spatial >= 12 && $reacteur_ff >= 10 && $armement >=12 && $blindage >= 12) {
echo "<form method=post action=validation_sto.php>
<tr>
<td><img src=images/sto.jpg ></td>
<td align=left>Station orbitale covenant ( ".$sto." vaisseaux )<br>Cette station reste en orbite autour de la planète et ne peut plus y bouger.<br>Métal : 500000<br>Cristal : 400000<br>Hydrogène : 250000<br>Temps : "; sec($q); echo"<br></td>
<td>"; if ( $bat == 9 ) { echo "Chantier spatial en construction"; } else { if ($temps_spatial < time() ) { echo "<input type=text class=zone_texte size=4 maxlength=4 name=cons_sto /><br><input type=submit value=Envoyer class=bouttom>"; } else {} }
echo"
</td></tr></form>"; } else {}
} else { ?><SCRIPT language="javascript">
parent.frames["changement"].window.location="sans_spatial.php"
</SCRIPT> <?
echo "<center><table><tr><td>Vous devez d'abord construire un chantier spatial !</td></tr></table></center>"; }
echo "</table>"; ?>
</body>
</html>