|
|
@ -46,7 +46,7 @@ class Request {
|
|
|
|
'base' => str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])),
|
|
|
|
'base' => str_replace('\\', '/', dirname($_SERVER['SCRIPT_NAME'])),
|
|
|
|
'method' => $_SERVER['REQUEST_METHOD'],
|
|
|
|
'method' => $_SERVER['REQUEST_METHOD'],
|
|
|
|
'referrer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
|
|
|
|
'referrer' => isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '',
|
|
|
|
'ip' => $_SERVER['REMOTE_ADDR'],
|
|
|
|
'ip' => $this->getIpAddress(),
|
|
|
|
'ajax' => isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') : false,
|
|
|
|
'ajax' => isset($_SERVER['HTTP_X_REQUESTED_WITH']) ? ($_SERVER['HTTP_X_REQUESTED_WITH'] == 'XMLHttpRequest') : false,
|
|
|
|
'scheme' => $_SERVER['SERVER_PROTOCOL'],
|
|
|
|
'scheme' => $_SERVER['SERVER_PROTOCOL'],
|
|
|
|
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
|
|
|
'user_agent' => $_SERVER['HTTP_USER_AGENT'],
|
|
|
@ -103,5 +103,32 @@ class Request {
|
|
|
|
|
|
|
|
|
|
|
|
return $params;
|
|
|
|
return $params;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
/**
|
|
|
|
|
|
|
|
* Gets the real remote IP address.
|
|
|
|
|
|
|
|
*
|
|
|
|
|
|
|
|
* @return string IP address
|
|
|
|
|
|
|
|
*/
|
|
|
|
|
|
|
|
private function getIpAddress() {
|
|
|
|
|
|
|
|
static $vars = array(
|
|
|
|
|
|
|
|
'HTTP_CLIENT_IP',
|
|
|
|
|
|
|
|
'HTTP_X_FORWARDED_FOR',
|
|
|
|
|
|
|
|
'HTTP_X_FORWARDED',
|
|
|
|
|
|
|
|
'HTTP_X_CLUSTER_CLIENT_IP',
|
|
|
|
|
|
|
|
'HTTP_FORWARDED_FOR',
|
|
|
|
|
|
|
|
'HTTP_FORWARDED',
|
|
|
|
|
|
|
|
'REMOTE_ADDR'
|
|
|
|
|
|
|
|
);
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
foreach ($vars as $key) {
|
|
|
|
|
|
|
|
if (array_key_exists($key, $_SERVER) === true) {
|
|
|
|
|
|
|
|
foreach (explode(',', $_SERVER[$key]) as $ip) {
|
|
|
|
|
|
|
|
if (filter_var($ip, FILTER_VALIDATE_IP) !== false) {
|
|
|
|
|
|
|
|
return $ip;
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
|
|
|
|
}
|
|
|
|
}
|
|
|
|
}
|
|
|
|
?>
|
|
|
|
?>
|
|
|
|