Moved IP checking code to check_ip.php

This commit is contained in:
Polonkai Gergely 2012-04-17 16:44:25 +00:00
parent 66f1326dca
commit 21ecbcefd0
3 changed files with 13 additions and 14 deletions

View File

@ -6,13 +6,7 @@
// this check prevents access to debug front controllers that are deployed by accident to production servers. // this check prevents access to debug front controllers that are deployed by accident to production servers.
// feel free to remove this, extend it, or make something more sophisticated. // feel free to remove this, extend it, or make something more sophisticated.
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( require_once __DIR__.'/check_ip.php';
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('You (' . @$_SERVER['REMOTE_ADDR'] . ') are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
require_once __DIR__.'/../app/bootstrap.php.cache'; require_once __DIR__.'/../app/bootstrap.php.cache';
require_once __DIR__.'/../app/AppKernel.php'; require_once __DIR__.'/../app/AppKernel.php';

11
web/check_ip.php Normal file
View File

@ -0,0 +1,11 @@
<?php
if (!in_array(@$_SERVER['REMOTE_ADDR'], array(
'127.0.0.1',
'::1',
'82.131.168.149', // Vörös Oroszlán - 2012 április 13.
'94.21.19.129', // Otthon - 2012 április 13.
'89.133.219.66', // Brokernet - 2012 április 17.
))) {
header('HTTP/1.0 403 Forbidden');
exit('You (' . @$_SERVER['REMOTE_ADDR'] . ') are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}

View File

@ -4,13 +4,7 @@ if (!isset($_SERVER['HTTP_HOST'])) {
exit('This script cannot be run from the CLI. Run it from a browser.'); exit('This script cannot be run from the CLI. Run it from a browser.');
} }
if (!in_array(@$_SERVER['REMOTE_ADDR'], array( require_once __DIR__.'/check_ip.php';
'127.0.0.1',
'::1',
))) {
header('HTTP/1.0 403 Forbidden');
exit('You (' . @$_SERVER['REMOTE_ADDR'] . ') are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
}
$majorProblems = array(); $majorProblems = array();
$minorProblems = array(); $minorProblems = array();