forked from halo-battle/game
Version 1.9a
This commit is contained in:
parent
5f81f76b17
commit
d028822d0b
437 changed files with 27543 additions and 81793 deletions
|
|
@ -10,24 +10,24 @@ define("MAX_AMAS", $config['nb_amas']);
|
|||
define("MAX_SYSTEME", $config['nb_systeme']);
|
||||
define("MAX_PLANETE", $config['nb_planete']);
|
||||
|
||||
require_once(_FCORE."hb_game/function.php");
|
||||
require_once(_FCORE."hb_game/tables.php");
|
||||
require_once(_FCORE."../game/function.php");
|
||||
require_once(_FCORE."../game/tables.php");
|
||||
|
||||
//On prépare le gestionnaire de templates
|
||||
$template = new Template();
|
||||
|
||||
$template->assign('date', strftime("%A %d %B %Y %H:%M"));
|
||||
$template->assign('datehb', str_replace('.', '', strftime("/%a %d %b %Y/%H%M %S")));
|
||||
$template->assign('date', utf8_encode(strftime("%A %d %B %Y %H:%M")));
|
||||
$template->assign('datehb', utf8_encode(str_replace('.', '', strftime("/%a %d %b %Y/%H%M %S"))));
|
||||
|
||||
$template->assign('link', array_map("url", $config['link']));
|
||||
$template->assign('menu', array_map("url", $config['menu']));
|
||||
$template->assign('menua', array_map("url", $config['menuadmin']));
|
||||
$template->assign('url_serveur', $_SERVER['HTTP_HOST']);
|
||||
|
||||
include_once(_FCORE."hb_game/fermerServeur.php");
|
||||
include_once(_FCORE."../game/fermerServeur.php");
|
||||
|
||||
//On démarre la session
|
||||
$sess = new session();
|
||||
$sess = new Session();
|
||||
$sess->load();
|
||||
|
||||
$nanite = 0;
|
||||
|
|
@ -64,25 +64,46 @@ xtdi = ""; //implication degree
|
|||
</script>
|
||||
<script type="text/javascript" src="http://www.monsite.fr/xtcore.js"></script>');
|
||||
|
||||
//Récupération du cache
|
||||
if (file_exists(_FCORE."../game/cache/nbcovie.cache") && file_exists(_FCORE."../game/cache/nbhumain.cache") && time() - filemtime(_FCORE."../game/cache/nbcovie.cache") < 300) {
|
||||
$nbcovie['covenants'] = file_get_contents(_FCORE."../game/cache/nbcovie.cache");
|
||||
$nbhumain['humains'] = file_get_contents(_FCORE."../game/cache/nbhumain.cache");
|
||||
}
|
||||
if (file_exists(_FCORE."../game/cache/inline.cache") && time() - filemtime(_FCORE."../game/cache/inline.cache") < 60) $enligne['enligne'] = file_get_contents(_FCORE."../game/cache/inline.cache");
|
||||
|
||||
$bdd = new bdd();
|
||||
$bdd = new BDD();
|
||||
$bdd->connexion();
|
||||
|
||||
$nbcovie = $bdd->unique_query("SELECT COUNT(id) AS covenants FROM $table_user WHERE race = 'covenant';");
|
||||
$nbhumain = $bdd->unique_query("SELECT COUNT(id) AS humains FROM $table_user WHERE race = 'humain';");
|
||||
if (!isset($nbcovie) || !isset($nbhumain)) {
|
||||
$nbcovie = $bdd->unique_query("SELECT COUNT(id) AS covenants FROM $table_user WHERE race = 'covenant';");
|
||||
$nbhumain = $bdd->unique_query("SELECT COUNT(id) AS humains FROM $table_user WHERE race = 'humain';");
|
||||
file_put_contents(_FCORE."../game/cache/nbcovie.cache", $nbcovie['covenants']);
|
||||
file_put_contents(_FCORE."../game/cache/nbhumain.cache", $nbhumain['humains']);
|
||||
}
|
||||
|
||||
//Nombre de joueur(s) en ligne ^^
|
||||
$enligne = $bdd->unique_query("SELECT COUNT(xid) AS enligne FROM sessions WHERE active = true AND var_session !='';");
|
||||
if (!isset($enligne)) {
|
||||
$enligne = $bdd->unique_query("SELECT COUNT(session) AS enligne FROM sessions WHERE active = true AND var != '0';");
|
||||
file_put_contents(_FCORE."../game/cache/inline.cache", $enligne['enligne']);
|
||||
}
|
||||
|
||||
//Bandeau d'informations
|
||||
$infos = $bdd->query("SELECT * FROM $table_infoshead");
|
||||
|
||||
$bdd->deconnexion();
|
||||
|
||||
//Evite les attaques CSRF
|
||||
if (!empty($_SERVER['HTTP_REFERER']) && !ereg(time().'http://'.$_SERVER['HTTP_HOST'], time().$_SERVER['HTTP_REFERER']) && !defined('xCSRF')) {
|
||||
file_log("Possibilité d'attaque CSRF\n".var_export($_REQUEST,TRUE), 2);
|
||||
unset($_POST, $_GET);
|
||||
$_GET = $_POST = array();
|
||||
}
|
||||
|
||||
//Affichage du header
|
||||
$template->assign('infos',$infos);
|
||||
$template->assign('nbinfos',$bdd->num_rows-1);
|
||||
$template->assign('enligne',$enligne['enligne']);
|
||||
$template->assign('count',array('humains' => $nbhumain['humains'], 'covenants' => $nbcovie['covenants'], 'serveurs' => 'cette'));
|
||||
$template->assign('version', $config['version']);
|
||||
$template->assign('first_page', $config['first_page']);
|
||||
?>
|
||||
Loading…
Add table
Add a link
Reference in a new issue