array(
'temps' => '-',
'deblok' => 'Complètez les champs ci-dessus',
'conso' => '-'
)
);
}
elseif ($_POST['galaxie'] > 1 || $_POST['ss'] > 100 || $_POST['pos'] > 12 || $_POST['galaxie'] < 0 || $_POST['ss'] < 1 || $_POST['pos'] < 1 || ($_POST['galaxie'] < 1 && $auth_level < 6)) {
$datas = array(
'root' => array(
'temps' => 'Lieu inaccessible',
'deblok' => 'Corrigez la destination !',
'conso' => '-'
)
);
}
else {
$_POST['vitesse'] /= 100;
$temps = vais_tempsDeplacement($start_galaxie,$start_ss,$start_position,$_POST['galaxie'],$_POST['ss'],$_POST['pos'],$_SESSION['FL_vitesse'],$_POST['vitesse'],$_SESSION['FL_preparation'],$_SESSION['FL_chauffe']);
$conso = vais_conso($temps, $_SESSION['FL_nbvais'])*($_POST['vitesse']*10);
//On recherche si la flotte va faire un aller-retour ou un aller simple
if (isset($_POST['mission']) && is_numeric($_POST['mission']) && ($_POST['mission'] == '3')) $nbtrajet = 1;
else $nbtrajet = 2;
if ($temps == 0)
$datas = array(
'root' => array(
'temps' => 'Vous êtes sur cette planète',
'deblok' => 'Corrigez la destination !',
'conso' => '-'
)
);
elseif (preg_replace('@[^a-zA-Z0-9_]@i', '', $_POST['nom']) != $_POST['nom'] || empty($_POST['nom']))
$datas = array(
'root' => array(
'temps' => affTemp(floor($temps)),
'deblok' => 'Nom de la flotte incorrect !',
'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet))
)
);
/*elseif (empty($_POST['hyd']) || $_POST['hyd'] < $conso * 2)
$datas = array(
'root' => array(
'temps' => affTemp(floor($temps)),
'deblok' => 'Vous n\'avez pas embarqué assez d\'hydrogène pour faire l\'aller-retour !',
'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet))
)
);*/
else {
$cds = sha1('flotte'.$conso.'ß10'.time().'|HB;'.rand(10,99).$temps);
$_SESSION['flotte_cdsL'] = $cds;
$datas = array(
'root' => array(
'temps' => affTemp(floor($temps)),
'deblok' => '',
'conso' => separerNombres(floor($conso*($_POST['vitesse']/100)*$nbtrajet))
)
);
}
}
header("X-JSON: ".$json->encode($datas));
?>