moved ip whitelist to options

This commit is contained in:
Markus Staab
2013-08-19 10:34:03 +02:00
parent dbcbd6825e
commit 39466a8dbd
+3 -1
View File
@@ -3,6 +3,8 @@
$options = array( $options = array(
// which string should represent a tab for indentation // which string should represent a tab for indentation
'tabsize' => 4, 'tabsize' => 4,
// whitelist of IPs which don't need to be authenticated
'ip_whitelist' => array('127.0.0.1', '::1'),
); );
/** /**
@@ -18,7 +20,7 @@ $options = array(
* *
* Source on Github http://github.com/Seldaek/php-console * Source on Github http://github.com/Seldaek/php-console
*/ */
if (!in_array($_SERVER['REMOTE_ADDR'], array('127.0.0.1', '::1'), true)) { if (!in_array($_SERVER['REMOTE_ADDR'], $options['ip_whitelist'], true)) {
header('HTTP/1.1 401 Access unauthorized'); header('HTTP/1.1 401 Access unauthorized');
die('ERR/401 Go Away'); die('ERR/401 Go Away');
} }