0) { if ($metal - ($sa*500) >= 0) { if ($cristal - ($sa*300) >= 0) { $temps_caserne = time() + $sa*ceil(720/pow(1.25,($chantier_terrestre-1))); $unit = 1; $metal -= ($sa*500); $cristal -= ($sa*300); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vaisseau_1']) && $sa > 0) { if ($metal - ($sa*680) >= 0) { if ($cristal - ($sa*420) >= 0) { $temps_caserne = time() + $sa*ceil(2040/pow(1.25,($chantier_terrestre-3))); $unit = 2; $metal -= ($sa*680); $cristal -= ($sa*420); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vaisseau_2']) && $sa > 0) { if ($metal - ($sa*1000) >= 0) { if ($cristal - ($sa*600) >= 0) { $temps_caserne = time() + $sa*ceil(2700/pow(1.25,($chantier_terrestre-4))); $unit = 3; $metal -= ($sa*1000); $cristal -= ($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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vaisseau_3']) && $sa > 0) { if ($metal - ($sa*1400) >= 0) { if ($cristal - ($sa*950) >= 0) { $temps_caserne = time() + $sa*ceil(3960/pow(1.25,($chantier_terrestre-6))); $unit = 4; $metal -= ($sa*1400); $cristal -= ($sa*950); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vcl_1']) && $sa > 0) { if ($metal - ($sa*400) >= 0) { if ($cristal - ($sa*240) >= 0) { $temps_caserne = time() + $sa*ceil(600/pow(1.25,($chantier_terrestre-1))); $unit = 5; $metal -= ($sa*400); $cristal -= ($sa*240); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vcl_2']) && $sa > 0) { if ($metal - ($sa*480) >= 0) { if ($cristal - ($sa*260) >= 0) { $temps_caserne = time() + $sa*ceil(1080/pow(1.25,($chantier_terrestre-2))); $unit = 6; $metal -= ($sa*480); $cristal -= ($sa*260); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vcl_3']) && $sa > 0) { if ($metal - ($sa*600) >= 0) { if ($cristal - ($sa*420) >= 0) { $temps_caserne = time() + $sa*ceil(2160/pow(1.25,($chantier_terrestre-3))); $unit = 7; $metal -= ($sa*600); $cristal -= ($sa*420); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } elseif (isset($_POST['cons_vcl_4']) && $sa > 0) { if ($metal - ($sa*1000) >= 0) { if ($cristal - ($sa*500) >= 0) { $temps_caserne = time() + $sa*ceil(4680/pow(1.25,($chantier_terrestre-5))); $unit = 8; $metal -= ($sa*1000); $cristal -= ($sa*500); 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: chantier_terrestre.php"); } else echo "Pas assez de cristal !"; } else echo "Pas assez de métal !"; } else header("Location: chantier_terrestre.php"); } mysql_close(); ?>