diff --git a/.dockerignore b/.dockerignore index 8e0dd5e..2d3779b 100644 --- a/.dockerignore +++ b/.dockerignore @@ -1,5 +1,10 @@ .drone.yml .drone-manifest.yml +.data +.gitignore +Dockerfile +docker-compose.yml +nginx.conf onyx2/cache/*.cache.php onyx2/cache/signatures/*.sign onyx2/log/*.log diff --git a/entrypoint.sh b/entrypoint.sh index ddea297..a6cfedf 100755 --- a/entrypoint.sh +++ b/entrypoint.sh @@ -1,7 +1,8 @@ #!/bin/sh [ -n "$MYSQL_DATABASE" ] && sed -i -r "/db/s/=\s*'([^']*)'/= '${MYSQL_DATABASE}'/" onyx2/db/default.profile.php -[ -n "$MYSQL_HOST" ] && sed -i -r "/host/s/=\s*'([^']*)'/= '${MYSQL_HOST}'/" onyx2/db/default.profile.php +# superseed in onyx2/db/default.profile.php +#[ -n "$MYSQL_HOST" ] && sed -i -r "/host/s/=\s*'([^']*)'/= '${MYSQL_HOST}'/" onyx2/db/default.profile.php [ -n "$MYSQL_USER" ] && sed -i -r "/user/s/=\s*'([^']*)'/= '${MYSQL_USER}'/" onyx2/db/default.profile.php [ -n "$MYSQL_PASSWORD" ] && sed -i -r "/pass/s/=\s*'([^']*)'/= '${MYSQL_PASSWORD}'/" onyx2/db/default.profile.php diff --git a/onyx2/db/default.profile.php b/onyx2/db/default.profile.php index 09ee290..b367113 100644 --- a/onyx2/db/default.profile.php +++ b/onyx2/db/default.profile.php @@ -3,7 +3,11 @@ if(!defined('ONYX')) exit; $___profile['db'] = 'hb_game'; -$___profile['host'] = 'localhost'; +if (getenv("MYSQL_HOST") === False) { + $___profile['host'] = 'localhost'; +} else { + $___profile['host'] = getenv("MYSQL_HOST"); +} $___profile['user'] = 'hb'; $___profile['pass'] = 'hb'; diff --git a/onyx2/include/common.php b/onyx2/include/common.php index 568caab..92e52c4 100644 --- a/onyx2/include/common.php +++ b/onyx2/include/common.php @@ -4,6 +4,9 @@ if(!defined('ONYX')) exit; if (empty($sess->values["connected"]) && !defined("xCSRF")) define("xCSRF", true); +//A passer a True pour dev tranquillou (pas d'envois de mail, pas de https,...) +define("DEV", getenv("DEV")); + require_once("function.php"); //Inclusion des fonctions principales require_once("tables.php"); //Inclusion des noms des tables de base de données correspondant à l'architecture du serveur @@ -50,10 +53,11 @@ if (!empty($sess->values["connected"])) unset($header); //Evite les attaques CSRF -if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^https://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF"))) +if (DEV) { $protocole = "http"; } else { $protocole = "https"; } +if (!empty($_SERVER["HTTP_REFERER"]) && !(preg_match('#^'.$protocole.'://'.$_SERVER['HTTP_HOST'].'#', $_SERVER["HTTP_REFERER"]) && defined("xCSRF"))) { elog("Possibilité d'attaque CSRF\n".var_export($_REQUEST, TRUE), 2); unset($_POST, $_GET); $_GET = $_POST = array(); } -?> \ No newline at end of file +?> diff --git a/onyx2/include/server/inscription.php b/onyx2/include/server/inscription.php index 236b2cd..5e3135e 100644 --- a/onyx2/include/server/inscription.php +++ b/onyx2/include/server/inscription.php @@ -147,7 +147,13 @@ if (isset($_POST['HB_pseudo']) && isset($_POST['HB_mdp']) && isset($_POST['HB_co //$mail->Subject='Halo-Battle :: Pre-Inscription'; //$mail->Body='
Félicitations '.$pseudo.' !
Votre compte vient d'être enregistré sur notre serveur. Un mail de confirmation vous sera envoyé lors de la sortie du jeu en ligne Halo-Battle. Si vous ne recevez pas l\'email de confirmation, contactez un administrateur.
A très bientôt pour la sortie d'Halo-Battle !