game/securite.php

83 lines
5.1 KiB
PHP
Raw Normal View History

2007-11-04 11:00:00 +00:00
<?php
2007-11-05 11:00:00 +00:00
require('connectBDD.php');
2007-11-20 11:00:00 +00:00
require('fermerServeur.php');
2007-11-21 11:00:00 +00:00
$PUB = '<script type="text/javascript"><!--
google_ad_client = "pub-8183761828268957";
//468x60, date de cr<63>ation 20/11/07
google_ad_slot = "9088855275";
google_ad_width = 468;
google_ad_height = 60;
//--></script>
<script type="text/javascript"
src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
</script><br />';
2007-11-20 11:00:00 +00:00
//$HEADER = '<div class="centre" style="position: absolute; z-index: 100;"><table style="margin-left: auto; margin-right: auto; background: #FFCC00;"><tr><td style="background: #FFCC99;"><font color="#FF0000"><b><u>Attention :</u> Mise <20> jour en cours, certaines pages risquent d\'<27>tre inactives ou bugg<67>es quelques temps</b></font></td></tr></table></div>';
$HEADER = '';
2007-11-04 11:00:00 +00:00
// V<>rification que la session soit bien d<>finit et qu'elle ne soit pas vide
2007-11-05 11:00:00 +00:00
if (!isset($_SESSION) || $_SESSION['id'] == '' || $_SESSION['auth_level'] == '' || $_SESSION['galaxy'] == '' || $_SESSION['ss'] == '' || $_SESSION['pos'] == '') {
session_destroy();
unset($_SESSION);
2007-11-20 11:00:00 +00:00
print '<script type="text/javascript">top.location.href="../index.php?erreur=1";</script>';
//header('Location: ../index.php?erreur=1');
2007-11-04 11:00:00 +00:00
exit;
}
2008-11-19 11:00:00 +00:00
// V<>rification que l'utilisateur se soit bien identifi<66>
if (!isset($_SESSION['authConnexion']) || !$_SESSION['authConnexion']) {
session_destroy();
unset($_SESSION);
print '<script type="text/javascript">top.location.href="../index.php?erreur=1";</script>';
//header('Location: ../index.php?erreur=1');
exit;
}
2007-11-20 11:00:00 +00:00
/*// V<EFBFBD>rification que la session n'ait pas <EFBFBD>t<EFBFBD> vol<EFBFBD>e
2007-11-04 11:00:00 +00:00
if (!isset($_SESSION) || $_SESSION['ip'] == '' || $_SESSION['ip'] != $_SERVER["REMOTE_ADDR"] || $_SESSION['realip'] == '' || $_SESSION['realip'] != realip()) {
session_destroy();
unset($_SESSION);
2007-11-20 11:00:00 +00:00
print '<script type="text/javascript">top.location.href="../index.php?erreur=1";</script>';
//header('Location: ../index.php?erreur=1');
2007-11-04 11:00:00 +00:00
exit;
2007-11-20 11:00:00 +00:00
}*/
// V<>rification que le serveur ne soit pas en fase de maintenance
if ($_SESSION['auth_level'] < $fermerServeur_auth && ($fermerServeur_timeS < time() || empty($fermerServeur_timeS)))
print '<script type="text/javascript">top.location.href="../index.php?erreur=8";</script>';
2007-11-21 11:00:00 +00:00
elseif (($fermerServeur_timeS < time() || empty($fermerServeur_timeS)) && ($fermerServeur_timeE > time() || empty($fermerServeur_timeE))) {
2007-11-20 11:00:00 +00:00
//D<>but de maintenance
2007-11-21 11:00:00 +00:00
$HEADER .= '<div class="centre" style="position: absolute; z-index: 100;"><table style="margin-left: auto; margin-right: auto; background: #FFCC00;"><tr><td style="background: #FFCC99;"><font color="#FF0000"><b><u>Serveur en maintenance :</u> Le serveur est actuellement dans une phase de mise <20> jour. Certaines pages risquent d\'<27>tre inactives ou bugg<67>es quelques temps</b></font> R<>ouverture dans '.($fermerServeur_timeE-time()).' secondes</td></tr></table></div>';
2007-11-20 11:00:00 +00:00
//Fin de maintenance
2007-11-21 11:00:00 +00:00
//$HEADER .= '<div class="centre" style="position: absolute; z-index: 100;"><table style="margin-left: auto; margin-right: auto; background: #FFCC00;"><tr><td style="background: #FFCC99;"><font color="#FF0000"><b><u>Serveur en maintenance :</u> Le transfert et l\'activation des am<61>liorations a <20>t<EFBFBD> effectu<74>, veuillez rapporter tout bug dans la section sp<73>ciale du forum.<br />Lorsque ce message dispara<72>tra, les joueurs pourront de nouveau se logger.</b></font> R<>ouverture dans '.($fermerServeur_timeE-time()).' secondes</td></tr></table></div>';
}
2007-11-04 11:00:00 +00:00
// D<>connection automatique au bout de 20 min d'inactivit<69>
2007-11-05 11:00:00 +00:00
if (!isset($_SESSION) || $_SESSION['timestamp'] + 1200 < time()) {
2007-11-04 11:00:00 +00:00
session_destroy();
unset($_SESSION);
2007-11-20 11:00:00 +00:00
print '<script type="text/javascript">top.location.href="../index.php?erreur=5";</script>';
//header('Location: ../index.php?erreur=5');
2007-11-04 11:00:00 +00:00
exit;
}
2007-11-13 11:00:00 +00:00
/*// Fait patienter l'utilisateur s'il a fait une r<EFBFBD>qu<EFBFBD>te il y a moins de deux secondes
if (!isset($_SESSION['microtimestamp']) || time()+microtime() - $_SESSION['microtimestamp'] < 1.5) {
usleep((1.5-(time()+microtime() - $_SESSION['microtimestamp']))*1000000);
}*/
2007-11-04 11:00:00 +00:00
// V<>rification que la requ<71>te proviennent du serveur
if (!isset($_SERVER['HTTP_REFERER'])) $_SERVER['HTTP_REFERER'] = '';
2007-11-13 11:00:00 +00:00
if (!ereg(time().'http://127.0.0.1/', time().$_SERVER['HTTP_REFERER']) && !ereg(time().'http://confrerienoire.no-ip.org/', time().$_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
2007-11-21 11:00:00 +00:00
//if (!ereg(time().'http://battle.halo.fr/', time().$_SERVER['HTTP_REFERER']) && !ereg(time().'http://www.battle.halo.fr/', time().$_SERVER['HTTP_REFERER']) && !ereg(time().'http://www.halo2.fr/', time().$_SERVER['HTTP_REFERER']) && !ereg(time().'http://ligue.halo.fr/', time().$_SERVER['HTTP_REFERER']) && !ereg(time().'http://halo-game.com/', time().$_SERVER['HTTP_REFERER']) && $_SERVER['HTTP_REFERER'] != '') {
2007-11-04 11:00:00 +00:00
setHistorique('Requ<71>te depuis une adresse non officiel', 'Par mesure de s<>curit<69>, la requ<71>te de '.$_SESSION['id'].' a <20>t<EFBFBD> annul<75>e car l\'\'adresse de provenance ne correspond pas <20> celle du site : '.$_SERVER['HTTP_REFERER']);
session_destroy();
2007-11-20 11:00:00 +00:00
print '<script type="text/javascript">top.location.href="../index.php?erreur=4";</script>';
//header('Location: ../index.php?erreur=4');
2007-11-04 11:00:00 +00:00
exit;
}
2007-11-05 11:00:00 +00:00
$_SESSION['timestamp'] = time();
2007-11-13 11:00:00 +00:00
$_SESSION['microtimestamp'] = time()+microtime();
2007-11-05 11:00:00 +00:00
mysql_close();
2007-11-04 11:00:00 +00:00
?>