forked from halo-battle/game
Version 0.10
This commit is contained in:
parent
73645ccc1f
commit
b9c240c781
246 changed files with 10218 additions and 1598 deletions
94
pages/nn/chantier_terrestre_validation.php
Normal file
94
pages/nn/chantier_terrestre_validation.php
Normal file
|
|
@ -0,0 +1,94 @@
|
|||
<?php
|
||||
session_start();
|
||||
|
||||
$id=$_SESSION['id'];
|
||||
$galaxy=$_SESSION['galaxy'];
|
||||
$ss=$_SESSION['ss'];
|
||||
$pos=$_SESSION['pos'];
|
||||
$race=$_SESSION['race'];
|
||||
|
||||
require_once('bdd.php');
|
||||
require_once('noms.php');
|
||||
require('../connectBDD.php');
|
||||
|
||||
if ($_POST['type'] == 'e' && $labo >= 1 && !ereg('e,', implode(',',$fileVai).',')) {
|
||||
$temps_s = '';
|
||||
$veh = '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'] == 9) {
|
||||
$metal -= ($sa*500);
|
||||
$cristal -= ($sa*200);
|
||||
$temps_s = $sa*ceil(480/pow(1.25,($chantier_terrestre-1)));
|
||||
$veh = 9;
|
||||
}
|
||||
elseif ($_POST['type'] == 10) {
|
||||
$metal -= ($sa*4000);
|
||||
$cristal -= ($sa*2000);
|
||||
$temps_s = $sa*ceil(1560/pow(1.25,($chantier_terrestre-3)));
|
||||
$veh = 10;
|
||||
}
|
||||
elseif ($_POST['type'] == 11) {
|
||||
$metal -= ($sa*4500);
|
||||
$cristal -= ($sa*800);
|
||||
$hydrogene -= ($sa*600);
|
||||
$temps_s = $sa*ceil(1800/pow(1.25,($chantier_terrestre-4)));
|
||||
$veh = 11;
|
||||
}
|
||||
elseif ($_POST['type'] == 12) {
|
||||
$metal -= ($sa*12000);
|
||||
$cristal -= ($sa*10000);
|
||||
$hydrogene -= ($sa*1000);
|
||||
$temps_s = $sa*ceil(6720/pow(1.25,($chantier_terrestre-4)));
|
||||
$veh = 12;
|
||||
}
|
||||
elseif ($_POST['type'] == 13) {
|
||||
$metal -= ($sa*15000);
|
||||
$cristal -= ($sa*9500);
|
||||
$hydrogene -= ($sa*1500);
|
||||
$temps_s = $sa*ceil(12960/pow(1.25,($chantier_terrestre-8)));
|
||||
$veh = 13;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($veh) && $veh != '' && (!empty($nomvaisn[$veh-1]) || $veh == 'e' || (isset($_GET['act']) && $_GET['act'] == 'e'))) {
|
||||
if ($metal >= 0 && $cristal >= 0 && $hydrogene >= 0) {
|
||||
for ($c=0 ; $c < $sa ; $c++){
|
||||
$fileVai = explode(' ',implode(' ',$fileVai).' '.$veh);
|
||||
}
|
||||
$veh = 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='$veh' WHERE id_user='$id' AND galaxie='$galaxy' AND ss='$ss' AND position='$pos'") or die ("erreur sql ".mysql_error());
|
||||
}
|
||||
else {
|
||||
if ($veh >= 9 ) header('Location: chantier_terrestre.php?err=3');
|
||||
else header('Location: chantier_terrestre.php?err=3');
|
||||
mysql_close();
|
||||
exit;
|
||||
}
|
||||
}
|
||||
mysql_close();
|
||||
$veh = $fileVai[0];
|
||||
if ($veh >= 9 ) header('Location: defense.php');
|
||||
else header('Location: chantier_terrestre.php');
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue