Moved development IPs to dev-ips.php
Signed-off-by: Gergely POLONKAI (W00d5t0ck) <polesz@w00d5t0ck.info>
This commit is contained in:
parent
082a0130c2
commit
5295ada144
@ -1,5 +1,7 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require 'dev-ips.php';
|
||||||
|
|
||||||
use Symfony\Component\HttpFoundation\Request;
|
use Symfony\Component\HttpFoundation\Request;
|
||||||
|
|
||||||
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
|
// If you don't want to setup permissions the proper way, just uncomment the following PHP line
|
||||||
@ -10,10 +12,7 @@ use Symfony\Component\HttpFoundation\Request;
|
|||||||
// 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 (isset($_SERVER['HTTP_CLIENT_IP'])
|
if (isset($_SERVER['HTTP_CLIENT_IP'])
|
||||||
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
|| isset($_SERVER['HTTP_X_FORWARDED_FOR'])
|
||||||
|| !in_array(@$_SERVER['REMOTE_ADDR'], array(
|
|| !in_array(@$_SERVER['REMOTE_ADDR'], $dev_ips)
|
||||||
'127.0.0.1',
|
|
||||||
'::1',
|
|
||||||
))
|
|
||||||
) {
|
) {
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
exit('You are not allowed to access this file. Check '.basename(__FILE__).' for more information.');
|
||||||
|
@ -1,13 +1,12 @@
|
|||||||
<?php
|
<?php
|
||||||
|
|
||||||
|
require 'dev-ips.php';
|
||||||
|
|
||||||
if (!isset($_SERVER['HTTP_HOST'])) {
|
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(
|
if (!in_array(@$_SERVER['REMOTE_ADDR'], $dev_ips)) {
|
||||||
'127.0.0.1',
|
|
||||||
'::1',
|
|
||||||
))) {
|
|
||||||
header('HTTP/1.0 403 Forbidden');
|
header('HTTP/1.0 403 Forbidden');
|
||||||
exit('This script is only accessible from localhost.');
|
exit('This script is only accessible from localhost.');
|
||||||
}
|
}
|
||||||
|
5
web/dev-ips.php
Normal file
5
web/dev-ips.php
Normal file
@ -0,0 +1,5 @@
|
|||||||
|
<?php
|
||||||
|
$dev_ips = array(
|
||||||
|
'127.0.0.1',
|
||||||
|
'::1',
|
||||||
|
);
|
Loading…
Reference in New Issue
Block a user