forked from halo-battle/game
Version 1.7i
This commit is contained in:
parent
8a8280758b
commit
ba5e741c99
136 changed files with 2561 additions and 2105 deletions
30
onyx/hb_game/jeu/bourse.php
Normal file
30
onyx/hb_game/jeu/bourse.php
Normal file
|
|
@ -0,0 +1,30 @@
|
|||
<?php
|
||||
if(!defined('INDEX')) { header('Location: ../'); exit; }
|
||||
$page = 'bourse';
|
||||
$titre = 'Bourse';
|
||||
|
||||
$ressourceArgent = 'metal';
|
||||
|
||||
$bdd->connexion();
|
||||
$queryBourseMetal = $bdd->unique_query("SELECT SUM(nombre) AS nombre, SUM(prix)/COUNT(prix) AS prix FROM $table_bourse WHERE type = 0;");
|
||||
$queryBourseCristal = $bdd->unique_query("SELECT SUM(nombre) AS nombre, SUM(prix)/COUNT(prix) AS prix FROM $table_bourse WHERE type = 1;");
|
||||
$queryBourseHydrogene = $bdd->unique_query("SELECT SUM(nombre) AS nombre, SUM(prix)/COUNT(prix) AS prix FROM $table_bourse WHERE type = 2;");
|
||||
$bdd->deconnexion();
|
||||
|
||||
if (isset($_POST['metal']) is_numeric($_POST['metal'])) {
|
||||
$demand = floor($_POST['metal'])
|
||||
if ($queryPlanete[$ressourceArgent] >= $queryBourseMetal['prix']*$demand && ) {
|
||||
$queryBMetal = $bdd->query("SELECT id, nombre FROM $table_bourse WHERE type = 0 ORDER BY prix ASC;");
|
||||
|
||||
$dispo =
|
||||
for($i = 0; ($i < $bdd->num_rows || ); $i++){
|
||||
$queryBMetal[$i]
|
||||
}
|
||||
|
||||
$argent = $queryPlanete[$ressourceArgent] - $queryBourseMetal['prix']*$demand;
|
||||
$bdd->query("UPDATE $table_planete SET $ressourceArgent = $argent WHERE id = '$idPlan';");
|
||||
}
|
||||
}
|
||||
|
||||
$template->assign('bourse', array($queryBourseMetal, $queryBourseCristal, $queryBourseHydrogene));
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue