2007-10-27 10:00:00 +00:00
< ? php
session_start ();
if ( isset ( $_POST [ 'cons_sto' ]) || isset ( $_POST [ 'cons_sonde' ]) || isset ( $_POST [ 'cons_vcolo' ]) || isset ( $_POST [ 'cons_transporteur' ]) || isset ( $_POST [ 'cons_gtransporteur' ]) || isset ( $_POST [ 'cons_chasseur' ]) || isset ( $_POST [ 'cons_fregate' ]) || isset ( $_POST [ 'cons_croiseur2' ]) || isset ( $_POST [ 'cons_croiseur' ])) {
$id = $_SESSION [ 'id' ];
$galaxy = $_SESSION [ 'galaxy' ];
$ss = $_SESSION [ 'ss' ];
$pos = $_SESSION [ 'pos' ];
$race = $_SESSION [ 'race' ];
require_once ( 'bdd.php' );
require ( '../connectBDD.php' );
$sa = 0 ;
if ( isset ( $_POST [ 'cons_transporteur' ])) $sa = floor ( $_POST [ 'cons_transporteur' ]);
if ( isset ( $_POST [ 'cons_vcolo' ])) $sa = floor ( $_POST [ 'cons_vcolo' ]);
if ( isset ( $_POST [ 'cons_sonde' ])) $sa = floor ( $_POST [ 'cons_sonde' ]);
2007-11-04 11:00:00 +00:00
if ( isset ( $_POST [ 'cons_recycleur' ])) $sa = floor ( $_POST [ 'cons_recycleur' ]);
2007-10-27 10:00:00 +00:00
if ( isset ( $_POST [ 'cons_chasseur' ])) $sa = floor ( $_POST [ 'cons_chasseur' ]);
if ( isset ( $_POST [ 'cons_croiseur' ])) $sa = floor ( $_POST [ 'cons_croiseur' ]);
if ( isset ( $_POST [ 'cons_croiseur2' ])) $sa = floor ( $_POST [ 'cons_croiseur2' ]);
if ( isset ( $_POST [ 'cons_fregate' ])) $sa = floor ( $_POST [ 'cons_fregate' ]);
if ( isset ( $_POST [ 'cons_gtransporteur' ])) $sa = floor ( $_POST [ 'cons_gtransporteur' ]);
2007-11-04 11:00:00 +00:00
if ( isset ( $_POST [ 'cons_pv' ])) $sa = floor ( $_POST [ 'cons_pv' ]);
2007-10-27 10:00:00 +00:00
if ( isset ( $_POST [ 'cons_sto' ])) $sa = floor ( $_POST [ 'cons_sto' ]);
if ( $sa < 0 ) $sa = 0 ;
if ( isset ( $_POST [ 'cons_transporteur' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 1000 ) >= 0 ) {
if ( $cristal - ( $sa * 800 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 1080 / pow ( 1.25 ,( $chantier_spatial - 1 )));
2007-10-27 10:00:00 +00:00
$unit = 1 ;
$metal -= ( $sa * 1000 );
$cristal -= ( $sa * 800 );
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_gtransporteur' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 4000 ) >= 0 ) {
if ( $cristal - ( $sa * 3000 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 6300 / pow ( 1.25 ,( $chantier_spatial - 5 )));
2007-10-27 10:00:00 +00:00
$unit = 2 ;
$metal -= ( $sa * 4000 );
$cristal -= ( $sa * 3000 );
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_vcolo' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 9000 ) >= 0 ) {
if ( $cristal - ( $sa * 9000 ) >= 0 ) {
if ( $hydrogene - ( $sa * 1000 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 8280 / pow ( 1.25 ,( $chantier_spatial - 5 )));
2007-10-27 10:00:00 +00:00
$unit = 3 ;
$metal -= ( $sa * 9000 );
$cristal -= ( $sa * 9000 );
$hydrogene -= ( $sa * 1000 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
2007-11-04 11:00:00 +00:00
elseif ( isset ( $_POST [ 'cons_sonde' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 1000 ) >= 0 ) {
if ( $cristal - ( $sa * 1200 ) >= 0 ) {
if ( $hydrogene - ( $sa * 100 ) >= 0 ) {
$temps_caserne = time () + $sa * ceil ( 1440 / pow ( 1.25 ,( $chantier_spatial - 3 )));
$unit = 4 ;
$metal -= ( $sa * 1000 );
$cristal -= ( $sa * 1200 );
$hydrogene -= ( $sa * 100 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_recycleur' ]) && $sa != 0 ) {
2007-10-27 10:00:00 +00:00
if ( $metal - ( $sa * 15000 ) >= 0 ) {
if ( $cristal - ( $sa * 9000 ) >= 0 ) {
if ( $hydrogene - ( $sa * 1000 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 7380 / pow ( 1.25 ,( $chantier_spatial - 5 )));
2007-10-27 10:00:00 +00:00
$unit = 5 ;
$metal -= ( $sa * 15000 );
$cristal -= ( $sa * 9000 );
$hydrogene -= ( $sa * 1000 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_chasseur' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 1700 ) >= 0 ) {
if ( $cristal - ( $sa * 1220 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 1200 / pow ( 1.25 ,( $chantier_spatial - 1 )));
2007-10-27 10:00:00 +00:00
$unit = 6 ;
$metal -= ( $sa * 1700 );
$cristal -= ( $sa * 1220 );
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_fregate' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 5800 ) >= 0 ) {
if ( $cristal - ( $sa * 1400 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 4680 / pow ( 1.25 ,( $chantier_spatial - 3 )));
2007-10-27 10:00:00 +00:00
$unit = 7 ;
$metal -= ( $sa * 5800 );
$cristal -= ( $sa * 1400 );
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_croiseur' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 20000 ) >= 0 ) {
if ( $cristal - ( $sa * 16000 ) >= 0 ) {
if ( $hydrogene - ( $sa * 1600 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 16800 / pow ( 1.25 ,( $chantier_spatial - 6 )));
2007-10-27 10:00:00 +00:00
$unit = 8 ;
$metal -= ( $sa * 20000 );
$cristal -= ( $sa * 16000 );
$hydrogene -= ( $sa * 1600 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_croiseur2' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 26000 ) >= 0 ) {
if ( $cristal - ( $sa * 16400 ) >= 0 ) {
if ( $hydrogene - ( $sa * 1600 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 18060 / pow ( 1.25 ,( $chantier_spatial - 6 )));
2007-10-27 10:00:00 +00:00
$unit = 9 ;
$metal -= ( $sa * 26000 );
$cristal -= ( $sa * 16400 );
$hydrogene -= ( $sa * 1600 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
2007-11-04 11:00:00 +00:00
elseif ( isset ( $_POST [ 'cons_pv' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 60000 ) >= 0 ) {
if ( $cristal - ( $sa * 40000 ) >= 0 ) {
if ( $hydrogene - ( $sa * 3000 ) >= 0 ) {
$temps_caserne = time () + $sa * ceil ( 32400 / pow ( 1.25 ,( $chantier_spatial - 8 )));
$unit = 10 ;
$metal -= ( $sa * 60000 );
$cristal -= ( $sa * 40000 );
$hydrogene -= ( $sa * 3000 );
2007-10-27 10:00:00 +00:00
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
elseif ( isset ( $_POST [ 'cons_sto' ]) && $sa != 0 ) {
if ( $metal - ( $sa * 500000 ) >= 0 ) {
if ( $cristal - ( $sa * 400000 ) >= 0 ) {
if ( $hydrogene - ( $sa * 250000 ) >= 0 ) {
2007-11-04 11:00:00 +00:00
$temps_caserne = time () + $sa * ceil ( 117000 / pow ( 1.25 ,( $chantier_spatial - 12 )));
2007-10-27 10:00:00 +00:00
$unit = 11 ;
$metal -= ( $sa * 500000 );
$cristal -= ( $sa * 400000 );
$hydrogene -= ( $sa * 250000 );
}
else echo " Pas assez d'hydrog<6F> ne ! " ;
}
else echo " Pas assez de cristal ! " ;
}
else echo " Pas assez de m<> tal ! " ;
}
else @ header ( " Location: chantier_spatial.php " );
2007-11-09 11:00:00 +00:00
if ( isset ( $unit ) && $unit != '' ) {
if ( $metal < 0 || $cristal < 0 || $hydrogene < 0 ) { }
else {
mysql_query ( " UPDATE planete SET unit_s=' $unit ', metal=' $metal ', cristal=' $cristal ', hydrogene=' $hydrogene ' WHERE id_user=' $id ' AND galaxie=' $galaxy ' AND ss=' $ss ' AND position=' $pos ' " );
mysql_query ( " UPDATE planete SET cons_spatial=' $sa ', temps_spatial=' $temps_caserne ' WHERE id_user=' $id ' AND galaxie=' $galaxy ' AND ss=' $ss ' AND position=' $pos ' " );
@ header ( " Location: chantier_spatial.php " );
}
}
2007-10-27 10:00:00 +00:00
mysql_close ();
}
?>