mirror of
https://github.com/silverstripe/silverstripe-framework
synced 2024-10-22 14:05:37 +02:00
Add checks to see if REMOTE_ADDR is set before making use of it.
git-svn-id: svn://svn.silverstripe.com/silverstripe/open/modules/sapphire/trunk@60578 467b73ca-7a2a-4603-9d3b-597d59a354a9
This commit is contained in:
parent
48b60fa710
commit
128e5e4a05
@ -207,6 +207,7 @@ class Session {
|
|||||||
public static function load_config() {
|
public static function load_config() {
|
||||||
foreach(self::$session_ips as $sessionIP => $timeout) {
|
foreach(self::$session_ips as $sessionIP => $timeout) {
|
||||||
if(preg_match('/^([0-9.]+)\s?-\s?([0-9.]+)$/', $sessionIP, $ips)) {
|
if(preg_match('/^([0-9.]+)\s?-\s?([0-9.]+)$/', $sessionIP, $ips)) {
|
||||||
|
if(isset($_SERVER['REMOTE_ADDR'])) {
|
||||||
$startIP = ip2long($ips[1]);
|
$startIP = ip2long($ips[1]);
|
||||||
$endIP = ip2long($ips[2]);
|
$endIP = ip2long($ips[2]);
|
||||||
$clientIP = ip2long($_SERVER['REMOTE_ADDR']);
|
$clientIP = ip2long($_SERVER['REMOTE_ADDR']);
|
||||||
@ -217,6 +218,7 @@ class Session {
|
|||||||
return self::set_timeout($timeout);
|
return self::set_timeout($timeout);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
}
|
||||||
// TODO - Net masks or something
|
// TODO - Net masks or something
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -349,7 +349,7 @@ class HTTPRequest extends Object implements ArrayAccess {
|
|||||||
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
} elseif (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
|
||||||
//to check ip is pass from proxy
|
//to check ip is pass from proxy
|
||||||
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
return $_SERVER['HTTP_X_FORWARDED_FOR'];
|
||||||
} else {
|
} elseif(isset($_SERVER['REMOTE_ADDR'])) {
|
||||||
return $_SERVER['REMOTE_ADDR'];
|
return $_SERVER['REMOTE_ADDR'];
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
Reference in New Issue
Block a user