forked from halo-battle/game
Version 0.9a
This commit is contained in:
parent
d5c122a2c5
commit
59fbc7104e
141 changed files with 8686 additions and 1156 deletions
92
pages/defense_validation.php
Normal file
92
pages/defense_validation.php
Normal file
|
|
@ -0,0 +1,92 @@
|
|||
<?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(',',$fileVeh).',')) {
|
||||
$temps_v = '';
|
||||
$veh = 'e';
|
||||
}
|
||||
else {
|
||||
// Annulation de la production en chaîne si elle existe
|
||||
//if (ereg('e,', implode(',',$fileVeh).',')) { 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 && $chantier_terrestre >= 2) {
|
||||
$metal -= 500*$sa;
|
||||
$cristal -= 200*$sa;
|
||||
$temps_v = ceil(480/pow(1.25,($chantier_terrestre-1)));
|
||||
$veh = 9;
|
||||
}
|
||||
elseif ($_POST['type'] == 10) {
|
||||
$metal -= 4000*$sa;
|
||||
$cristal -= 2000*$sa;
|
||||
$temps_v = ceil(1560/pow(1.25,($chantier_terrestre-3)));
|
||||
$veh = 10;
|
||||
}
|
||||
elseif ($_POST['type'] == 11) {
|
||||
$metal -= 4500*$sa;
|
||||
$cristal -= 800*$sa;
|
||||
$hydrogene -= 600*$sa;
|
||||
$temps_v = ceil(1800/pow(1.25,($chantier_terrestre-4)));
|
||||
$veh = 11;
|
||||
}
|
||||
elseif ($_POST['type'] == 12) {
|
||||
$metal -= 12000*$sa;
|
||||
$cristal -= 10000*$sa;
|
||||
$hydrogene -= 1000*$sa;
|
||||
$temps_v = ceil(6720/pow(1.25,($chantier_terrestre-4)));
|
||||
$veh = 12;
|
||||
}
|
||||
elseif ($_POST['type'] == 13) {
|
||||
$metal -= 15000*$sa;
|
||||
$cristal -= 9500*$sa;
|
||||
$hydrogene -= 1500*$sa;
|
||||
$temps_v = ceil(12960/pow(1.25,($chantier_terrestre-8)));
|
||||
$veh = 13;
|
||||
}
|
||||
}
|
||||
|
||||
if (isset($veh) && $veh != '' && (!empty($nomterrn[$veh-1]) || $veh == 'e' || (isset($_GET['act']) && $_GET['act'] == 'e'))) {
|
||||
if ($metal >= 0 && $cristal >= 0 && $hydrogene >= 0) {
|
||||
for ($c=0 ; $c < $sa ; $c++){
|
||||
$fileVeh = explode(' ',implode(' ',$fileVeh).' '.$veh);
|
||||
}
|
||||
$veh = implode(' ',$fileVeh);
|
||||
if (count($fileTemps_t) == 0 || count($fileTemps_t) == 1) {
|
||||
$temps_vs = time();
|
||||
for ($c=0 ; $c < $sa ; $c++){
|
||||
$temps_vs .= ' '.$temps_v;
|
||||
}
|
||||
$temps_v = $temps_vs;
|
||||
}
|
||||
else {
|
||||
$temps_vs = implode(' ',$fileTemps_t);
|
||||
for ($c=0 ; $c < $sa ; $c++){
|
||||
$temps_vs .= ' '.$temps_v;
|
||||
}
|
||||
$temps_v = $temps_vs;
|
||||
}
|
||||
|
||||
mysql_query("UPDATE planete SET metal='$metal', cristal='$cristal', temps_t='$temps_v', unit_t='$veh' 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();
|
||||
$veh = $fileVeh[0];
|
||||
if (isset($_GET['go']) && $_GET['go'] == 1) header('Location: chantier_spatial.php?err=2');
|
||||
else header('Location: defense.php');
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue