= 1 && !ereg('e,', implode(',',$fileVai).',')) { $temps_s = ''; $vai = 'e'; } else { // Annulation de la production en chaîne si elle existe //if (ereg('e,', implode(',',$fileVai).',')) { header('Location: annul_bat.php?bat=e&go='.$_POST['type']); exit; } if (!isset($_POST['sa'])) exit; else $sa = abs(floor($_POST['sa'])); if ($_POST['type'] == 1) { $metal -= 1000*$sa; $cristal -= 800*$sa; $temps_s = ceil(1080/pow(1.25,($chantier_spatial-1))); $vai = 1; } elseif ($_POST['type'] == 2) { $metal -= 4000*$sa; $cristal -= 3000*$sa; $temps_s = ceil(6300/pow(1.25,($chantier_spatial-5))); $vai = 2; } elseif ($_POST['type'] == 3) { $metal -= 9000*$sa; $cristal -= 9000*$sa; $hydrogene -= 1000*$sa; $temps_s = ceil(8280/pow(1.25,($chantier_spatial-5))); $vai = 3; } elseif ($_POST['type'] == 4) { $metal -= 1000*$sa; $cristal -= 1200*$sa; $hydrogene -= 100*$sa; $temps_s = ceil(1440/pow(1.25,($chantier_spatial-3))); $vai = 4; } elseif ($_POST['type'] == 5 && $centrale_s >= 12 && $energie_t >= 5) { $metal -= 15000*$sa; $cristal -= 9000*$sa; $hydrogene -= 1000*$sa; $temps_s = ceil(7380/pow(1.25,($chantier_spatial-5))); $vai = 5; } elseif ($_POST['type'] == 6 && $detection >= 1) { $metal -= 1700*$sa; $cristal -= 1220*$sa; $temps_s = ceil(1200/pow(1.25,($chantier_spatial-1))); $vai = 6; } elseif ($_POST['type'] == 7) { $metal -= 5800*$sa; $cristal -= 1400*$sa; $temps_s = ceil(4680/pow(1.25,($chantier_spatial-3))); $vai = 7; } elseif ($_POST['type'] == 8) { $metal -= 20000*$sa; $cristal -= 16000*$sa; $hydrogene -= 1600*$sa; $temps_s = ceil(16800/pow(1.25,($chantier_spatial-6))); $vai = 8; } elseif ($_POST['type'] == 9 && $chantier_terrestre >= 2) { $metal -= 26000*$sa; $cristal -= 16400*$sa; $hydrogene -= 1600*$sa; $temps_s = ceil(18060/pow(1.25,($chantier_spatial-6))); $vai = 9; } elseif ($_POST['type'] == 10) { $metal -= 60000*$sa; $cristal -= 40000*$sa; $hydrogene -= 3000*$sa; $temps_s = ceil(32400/pow(1.25,($chantier_spatial-8))); $vai = 10; } elseif ($_POST['type'] == 11) { $metal -= 500000*$sa; $cristal -= 400000*$sa; $hydrogene -= 250000*$sa; $temps_s = ceil(117000/pow(1.25,($chantier_spatial-12))); $vai = 11; } elseif ($_POST['type'] == 12) { $metal -= 500000*$sa; $cristal -= 400000*$sa; $hydrogene -= 250000*$sa; $temps_s = ceil(117000/pow(1.25,($chantier_spatial-12))); $vai = 12; } } if (isset($vai) && $vai != '' && (!empty($nomvaisn[$vai-1]) || $vai == 'e' || (isset($_GET['act']) && $_GET['act'] == 'e'))) { if ($metal >= 0 && $cristal >= 0 && $hydrogene >= 0) { for ($c=0 ; $c < $sa ; $c++){ $fileVai = explode(' ',implode(' ',$fileVai).' '.$vai); } $vai = implode(' ',$fileVai); if (count($fileTemps_s) == 0 || count($fileTemps_s) == 1) { $temps_ss = time(); for ($c=0 ; $c < $sa ; $c++){ $temps_ss .= ' '.$temps_s; } $temps_s = $temps_ss; } else { $temps_ss = implode(' ',$fileTemps_s); for ($c=0 ; $c < $sa ; $c++){ $temps_ss .= ' '.$temps_s; } $temps_s = $temps_ss; } mysql_query("UPDATE planete SET metal='$metal', cristal='$cristal', temps_spatial='$temps_s', unit_s='$vai' WHERE id_user='$id' AND galaxie='$galaxy' AND ss='$ss' AND position='$pos'") or die ("erreur sql ".mysql_error()); } else { header('Location: chantier_spatial.php?err=3'); exit; } } mysql_close(); $vai = $fileVai[0]; if (isset($_GET['go']) && $_GET['go'] == 1) header('Location: chantier_spatial.php?err=2'); else header('Location: chantier_spatial.php'); ?>