|
|
|
@ -46,7 +46,7 @@ class Request {
|
|
|
|
|
'base' => str_replace('\\', '/', dirname(getenv('SCRIPT_NAME'))),
|
|
|
|
|
'method' => getenv('REQUEST_METHOD') ?: 'GET',
|
|
|
|
|
'referrer' => getenv('HTTP_REFERER') ?: '',
|
|
|
|
|
'ip' => getenv('REMOTE_ADDR'),
|
|
|
|
|
'ip' => getenv('REMOTE_ADDR') ?: '',
|
|
|
|
|
'ajax' => getenv('HTTP_X_REQUESTED_WITH') == 'XMLHttpRequest',
|
|
|
|
|
'scheme' => getenv('SERVER_PROTOCOL') ?: 'HTTP/1.1',
|
|
|
|
|
'user_agent' => getenv('HTTP_USER_AGENT') ?: '',
|
|
|
|
@ -59,7 +59,7 @@ class Request {
|
|
|
|
|
'files' => new Collection($_FILES),
|
|
|
|
|
'secure' => getenv('HTTPS') && getenv('HTTPS') != 'off',
|
|
|
|
|
'accept' => getenv('HTTP_ACCEPT'),
|
|
|
|
|
'proxy' => $this->getProxyIpAddress()
|
|
|
|
|
'proxy_ip' => $this->getProxyIpAddress()
|
|
|
|
|
);
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
@ -121,16 +121,19 @@ class Request {
|
|
|
|
|
'HTTP_FORWARDED_FOR',
|
|
|
|
|
'HTTP_FORWARDED'
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
$flags = \FILTER_FLAG_NO_PRIV_RANGE | \FILTER_FLAG_NO_RES_RANGE;
|
|
|
|
|
|
|
|
|
|
foreach ($forwarded as $key) {
|
|
|
|
|
if (array_key_exists($key, $_SERVER)) {
|
|
|
|
|
sscanf($_SERVER[$key], '%[^,]', $ip);
|
|
|
|
|
if(filter_var($ip, FILTER_VALIDATE_IP, $flags) !== false) {
|
|
|
|
|
if (filter_var($ip, \FILTER_VALIDATE_IP, $flags) !== false) {
|
|
|
|
|
return $ip;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
return '';
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
?>
|
|
|
|
|