forked from halo-battle/game
Version 1.12
This commit is contained in:
parent
2a066a7498
commit
de31cd3e9a
1373 changed files with 156282 additions and 45238 deletions
47
game/Class/class.tinyplanete.php
Normal file
47
game/Class/class.tinyplanete.php
Normal file
|
|
@ -0,0 +1,47 @@
|
|||
<?php
|
||||
class TinyPlanete{
|
||||
var $id = 0,
|
||||
$galaxie,
|
||||
$ss,
|
||||
$position,
|
||||
$nom_planete;
|
||||
|
||||
/**
|
||||
* Constructeur
|
||||
* @param int $id id de la planète à importer
|
||||
*
|
||||
* @return void
|
||||
* @access public
|
||||
*/
|
||||
function TinyPlanete($id = 0){
|
||||
if (!empty($id)) {
|
||||
global $securePlanete;
|
||||
global $var___db, $config, $table_planete;
|
||||
global $batimentVAR, $casernenVAR, $nomterrnVAR, $nomvaisnVAR;
|
||||
$actuFile = true;
|
||||
$bdd = new bdd();
|
||||
|
||||
//On traite le cas où l'on envoie les coordonnées
|
||||
if (is_numeric($id)) {
|
||||
$bdd->connexion();
|
||||
$plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE id = $id;");
|
||||
$bdd->deconnexion();
|
||||
}
|
||||
elseif (preg_match('#^\[?([0-9]{1,2}):([0-9]{1,2}):([0-9]{1,2})\]?$#', $id, $position)) {
|
||||
$bdd->connexion();
|
||||
$plan = $bdd->unique_query("SELECT * FROM $table_planete WHERE galaxie = ".$position[1]." AND ss = ".$position[2]." AND position = ".$position[3].";");
|
||||
$bdd->deconnexion();
|
||||
}
|
||||
else die('Erreur #04 : Format de recherche de planete incorrect !');
|
||||
|
||||
if (!empty($plan)) {
|
||||
$this->id = $plan["id"];
|
||||
$this->galaxie = $plan["galaxie"];
|
||||
$this->ss = $plan["ss"];
|
||||
$this->position = $plan["position"];
|
||||
$this->nom_planete = $plan["nom_planete"];
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue