0) { if ($metal - ($sa*500) >= 0) { if ($cristal - ($sa*200) >= 0) { $temps_caserne = time() + $sa*ceil(480/pow(1.25,$chantier_terrestre)); $unit = 9; $metal -= ($sa*500); $cristal -= ($sa*200); mysql_query("UPDATE planete SET unit_t='$unit', temps_t='$temps_caserne', metal='$metal', cristal='$cristal', hydrogene='$hydrogene', cons_terrestre='$sa' WHERE galaxie='$galaxy' AND ss='$ss' AND position='$pos'") or die ("erreur sql ".mysql_error()); header("Location: defense.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_def_2']) && $sa > 0) { if ($metal - ($sa*4000) >= 0) { if ($cristal - ($sa*2000) >= 0) { $temps_caserne = time() + $sa*ceil(1560/pow(1.25,$chantier_terrestre)); $unit = 10; $metal -= ($sa*4000); $cristal -= ($sa*2000); mysql_query("UPDATE planete SET unit_t='$unit', temps_t='$temps_caserne', metal='$metal', cristal='$cristal', hydrogene='$hydrogene', cons_terrestre='$sa' WHERE galaxie='$galaxy' AND ss='$ss' AND position='$pos'"); header("Location: defense.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_def_3']) && $sa > 0) { if ($metal - ($sa*4500) >= 0) { if ($cristal - ($sa*8000) >= 0) { if($hydrogene - ($sa*600) >= 0) { $temps_caserne = time() + $sa*ceil(1800/pow(1.25,$chantier_terrestre)); $unit = 11; $metal -= ($sa*4500); $cristal -= ($sa*8000); $hydrogene -= ($sa*600); mysql_query("UPDATE planete SET unit_t='$unit', temps_t='$temps_caserne', metal='$metal', cristal='$cristal', hydrogene='$hydrogene', cons_terrestre='$sa' WHERE galaxie='$galaxy' AND ss='$ss' AND position='$pos'"); header("Location: defense.php"); } } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_def_4']) && $sa > 0) { if ($metal - ($sa*12000) >= 0) { if ($cristal - ($sa*10000) >= 0) { if($hydrogene - ($sa*1000) >= 0) { $temps_caserne = time() + $sa*ceil(6720/pow(1.25,$chantier_terrestre)); $unit = 12; $metal -= ($sa*12000); $cristal -= ($sa*10000); $hydrogene -= ($sa*1000); mysql_query("UPDATE planete SET unit_t='$unit', temps_t='$temps_caserne', metal='$metal', cristal='$cristal', hydrogene='$hydrogene', cons_terrestre='$sa' WHERE galaxie='$galaxy' AND ss='$ss' AND position='$pos'"); header("Location: defense.php"); } } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_def_5']) && $sa > 0) { if ($metal - ($sa*15000) >= 0) { if ($cristal - ($sa*9500) >= 0) { if($hydrogene - ($sa*1500) >= 0) { $temps_caserne = time() + $sa*ceil(12960/pow(1.25,$chantier_terrestre)); $unit = 13; $metal -= ($sa*15000); $cristal -= ($sa*9500); $hydrogene -= ($sa*1500); mysql_query("UPDATE planete SET unit_t='$unit', temps_t='$temps_caserne', metal='$metal', cristal='$cristal', hydrogene='$hydrogene', cons_terrestre='$sa' WHERE galaxie='$galaxy' AND ss='$ss' AND position='$pos'"); header("Location: defense.php"); } } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } else header("Location: defense.php"); } mysql_close(); ?>