Version 0.7
This commit is contained in:
parent
e0f55450e1
commit
c117da6d77
148 changed files with 1914 additions and 801 deletions
|
|
@ -1,5 +1,10 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
if (isset($_POST['vaisseau1']) || isset($_POST['vaisseau2']) || isset($_POST['vaisseau3']) || isset($_POST['vaisseau4']) ||
|
||||
isset($_POST['vaisseau5']) || isset($_POST['vaisseau6']) || isset($_POST['vaisseau7']) || isset($_POST['vaisseau8']) ||
|
||||
isset($_POST['vaisseau9']) || isset($_POST['vaisseau10']) || isset($_POST['vaisseau11']) || isset($_POST['vaisseau12'])) {
|
||||
|
||||
define('DESIGN', 'descriptions/diz/base.css');
|
||||
define('HEAD', '<script type="text/javascript">
|
||||
var coefvitesse = 1;
|
||||
|
|
@ -25,7 +30,7 @@ function reste(zetime) {
|
|||
}
|
||||
|
||||
function consomation(zetime,nbvais) {
|
||||
if (zetime > 0) document.getElementById(\'conso\').innerHTML = parseInt(zetime/6*100)*2;
|
||||
if (zetime > 0) document.getElementById(\'conso\').innerHTML = parseInt(zetime*nbvais/20)*2;
|
||||
else document.getElementById(\'conso\').innerHTML = 0;
|
||||
}
|
||||
|
||||
|
|
@ -68,6 +73,7 @@ require_once('ressource.php');
|
|||
<form method="post" action="creerflotte.php">
|
||||
<input type="hidden" name="action" value="apr">
|
||||
<?php
|
||||
|
||||
if (isset($_POST['vaisseau1'])) print '<input type="hidden" name="vaisseau1" value="'.$_POST['vaisseau1'].'">';
|
||||
if (isset($_POST['vaisseau2'])) print '<input type="hidden" name="vaisseau2" value="'.$_POST['vaisseau2'].'">';
|
||||
if (isset($_POST['vaisseau3'])) print '<input type="hidden" name="vaisseau3" value="'.$_POST['vaisseau3'].'">';
|
||||
|
|
@ -94,12 +100,13 @@ for ($i=0 ; $i<=12 ; $i++) {
|
|||
}
|
||||
}
|
||||
$AvaisType = split(' ', trim($AvaisType)); $AvaisVitesseC = split(' ', trim($AvaisVitesseC)); $AvaisVitesseL = split(' ', trim($AvaisVitesseL)); $AvaisContenu = split(' ', trim($AvaisContenu)); $AvaisPrepC = split(' ', trim($AvaisPrepC)); $AvaisPrepL = split(' ', trim($AvaisPrepL)); $AvaisChauffe = split(' ', trim($AvaisChauffe));
|
||||
if(min($AvaisVitesseC) == 0 && min($AvaisVitesseL) == 0) { print '<script type="text/javascript">window.location.href="flotte.php?err=7";</script>'; exit; }
|
||||
//if(min($AvaisVitesseC) == 0 && min($AvaisVitesseL) == 0) { print '<script type="text/javascript">window.location.href="flotte.php?err=7";</script>'; exit; }
|
||||
if(min($AvaisVitesseC) == 0 && min($AvaisVitesseL) == 0) $AvaisVitesseL = $AvaisVitesseC;
|
||||
?>
|
||||
<table align="center" width="500">
|
||||
<tr><td colspan="2">Préparation de la flotte</td></tr>
|
||||
<tr><td width="50%">Nom</td><td width="50%"><input type="text" name="nom" maxlength="255" size="20"></td></tr>
|
||||
<tr><td width="50%">Destination</td><td width="50%"><input type="text" name="galaxie" maxlength="1" size="2" onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>)" id="end_galaxie" value="<?php print $_SESSION['galaxy']; ?>">:<input type="text" name="ss" maxlength="3" size="2" onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>);" id="end_ss" value="<?php print $_SESSION['ss']; ?>">:<input type="text" name="position" maxlength="2" size="2" onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>);" id="end_position" value="<?php print $_SESSION['pos']; ?>"></td></tr>
|
||||
<tr><td width="50%">Nom</td><td width="50%"><input type="text" name="nom" maxlength="255" size="20" class="zone_texte"></td></tr>
|
||||
<tr><td width="50%">Destination</td><td width="50%"><input type="text" name="galaxie" maxlength="1" size="2" class="zone_texte" onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>)" id="end_galaxie" value="<?php print $_SESSION['galaxy']; ?>">:<input type="text" name="ss" maxlength="3" size="2" class="zone_texte"onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>);" id="end_ss" value="<?php print $_SESSION['ss']; ?>">:<input type="text" name="position" maxlength="2" size="2" class="zone_texte" onchange="vaisTempsDeplacement(document.getElementById('end_galaxie').value, document.getElementById('end_ss').value, document.getElementById('end_position').value,<?php print min($AvaisVitesseC)>0?min($AvaisVitesseC):min($AvaisVitesseL) ?>,<?php print min($AvaisPrepC)>0?min($AvaisPrepC):max($AvaisPrepL); ?>,<?php print min($AvaisPrepC)>0?0:max($AvaisChauffe); ?>,<?php print count($AvaisType); ?>);" id="end_position" value="<?php print $_SESSION['pos']; ?>"></td></tr>
|
||||
<tr><td width="50%">Vitesse</td><td width="50%"><select name="speed"><option value="100">100%</option></select></td></tr>
|
||||
<tr><td width="50%">Temps de déplacement</td><td width="50%" id="temps"></td></tr>
|
||||
<tr><td width="50%">Consomation</td><td width="50%" id="conso"></td></tr>
|
||||
|
|
@ -110,11 +117,10 @@ if (isset($_POST['vaisseau5']) && $_POST['vaisseau5'] > 0) print '<option value=
|
|||
if (isset($_POST['vaisseau3']) && $_POST['vaisseau3'] > 0) print '<option value="3" selected>Coloniser</option>';
|
||||
?>
|
||||
</select></td></tr>
|
||||
<tr><td width="50%"> </td><td width="50%"> </td></tr>
|
||||
<tr><td width="50%">Métal</td><td width="50%"><input type="text" name="metal" maxlength="6" size="10"></td></tr>
|
||||
<tr><td width="50%">Cristal</td><td width="50%"><input type="text" name="cristal" maxlength="6" size="10"></td></tr>
|
||||
<tr><td width="50%">Hydrogène</td><td width="50%"><input type="text" name="hydrogene" maxlength="6" size="10"></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Envoyer la flotte"></td></tr>
|
||||
<tr><td width="50%">Métal</td><td width="50%"><input type="text" name="metal" maxlength="6" size="10" class="zone_texte"></td></tr>
|
||||
<tr><td width="50%">Cristal</td><td width="50%"><input type="text" name="cristal" maxlength="6" size="10" class="zone_texte"></td></tr>
|
||||
<tr><td width="50%">Hydrogène</td><td width="50%"><input type="text" name="hydrogene" maxlength="6" size="10" class="zone_texte"></td></tr>
|
||||
<tr><td colspan="2"><input type="submit" value="Envoyer la flotte" class="bouton"></td></tr>
|
||||
</table>
|
||||
</form>
|
||||
<?php
|
||||
|
|
@ -134,27 +140,38 @@ if (isset($_POST['vaisseau3']) && $_POST['vaisseau3'] > 0) print '<option value=
|
|||
|
||||
// Vérification de la planète d'arrivé
|
||||
$reqVPlan = mysql_query("SELECT * FROM planete WHERE `galaxie` = '$Cgalaxie' AND `ss` = '$Css' AND `position` = '$Cposition'");
|
||||
if (mysql_num_rows($reqVPlan) == 0) {
|
||||
if (mysql_num_rows($reqVPlan) == 0 && $mission != 3) {
|
||||
header('Location: flotte.php?err=9');
|
||||
exit;
|
||||
}
|
||||
elseif (mysql_num_rows($reqVPlan) != 0 && $mission == 3) {
|
||||
header('Location: flotte.php?err=c1');
|
||||
exit;
|
||||
}
|
||||
elseif ($mission == 3) {
|
||||
$reqVPlanComp = mysql_query("SELECT * FROM planete WHERE `id_user` = '$id'");
|
||||
if (mysql_num_rows($reqVPlanComp) > 15) {
|
||||
header('Location: flotte.php?err=c2');
|
||||
exit;
|
||||
}
|
||||
}
|
||||
else {
|
||||
$resultatVPlan = mysql_fetch_array($reqVPlan);
|
||||
if ($mission == 0 && $resultatVPlan['id_user'] != $id) {
|
||||
header('Location: flotte.php?err=s1');
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
elseif ($mission == 1 && $resultatVPlan['id_user'] == $id) {
|
||||
header('Location: flotte.php?err=a1');
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
elseif ($mission == 5 && $resultatVPlan['id_user'] == $id) {
|
||||
header('Location: flotte.php?err=a1');
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
elseif ($mission == '') {
|
||||
header('Location: flotte.php?err=10');
|
||||
exit;
|
||||
exit;
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -228,13 +245,13 @@ if (isset($_POST['vaisseau3']) && $_POST['vaisseau3'] > 0) print '<option value=
|
|||
}
|
||||
}
|
||||
$AvaisType = split(' ', trim($AvaisType)); $AvaisVitesseC = split(' ', trim($AvaisVitesseC)); $AvaisVitesseL = split(' ', trim($AvaisVitesseL)); $AvaisContenu = split(' ', trim($AvaisContenu)); $AvaisPrepC = split(' ', trim($AvaisPrepC)); $AvaisPrepL = split(' ', trim($AvaisPrepL)); $AvaisChauffe = split(' ', trim($AvaisChauffe));
|
||||
if(min($AvaisVitesseC) != 0) {
|
||||
$timeDep = vais_tempsDeplacement($galaxy, $ss, $pos, $_POST['galaxie'],$_POST['ss'],$_POST['position'],min($AvaisVitesseC),1,max($AvaisPrepC),0);
|
||||
if(min($AvaisVitesseL) != 0) {
|
||||
$timeDep = vais_tempsDeplacement($galaxy, $ss, $pos, $_POST['galaxie'],$_POST['ss'],$_POST['position'],max($AvaisVitesseL),1,max($AvaisPrepL),max($AvaisChauffe));
|
||||
}
|
||||
elseif(min($AvaisVitesseL) != 0) {
|
||||
$timeDep = vais_tempsDeplacement($galaxy, $ss, $pos, $_POST['galaxie'],$_POST['ss'],$_POST['position'],min($AvaisVitesseL),1,max($AvaisPrepL),max($AvaisChauffe));
|
||||
else {
|
||||
$timeDep = vais_tempsDeplacement($galaxy, $ss, $pos, $_POST['galaxie'],$_POST['ss'],$_POST['position'],max($AvaisVitesseC),1,max($AvaisPrepC),0);
|
||||
}
|
||||
else { header('Location: flotte.php?err=7'); exit; }
|
||||
|
||||
|
||||
$metal -= $Cmetal;
|
||||
$cristal -= $Ccristal;
|
||||
|
|
@ -264,6 +281,8 @@ if (isset($_POST['vaisseau3']) && $_POST['vaisseau3'] > 0) print '<option value=
|
|||
header('Location: flotte.php?err=ok');
|
||||
}
|
||||
else header('Location: flotte.php');
|
||||
}
|
||||
else header('Location: flotte.php');
|
||||
?>
|
||||
</body>
|
||||
</html>
|
||||
Loading…
Add table
Add a link
Reference in a new issue