mirror of https://github.com/hnhx/librex.git
use X-Forwarded-For if available for ip queries
This commit is contained in:
parent
b5a9f12df9
commit
b1a34bc004
|
@ -1,9 +1,15 @@
|
|||
<?php
|
||||
function ip_result()
|
||||
{
|
||||
$ip = $_SERVER["REMOTE_ADDR"];
|
||||
|
||||
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
|
||||
$ip = reset(explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]));
|
||||
}
|
||||
|
||||
return array(
|
||||
"special_response" => array(
|
||||
"response" => $_SERVER["REMOTE_ADDR"],
|
||||
"response" => $ip,
|
||||
"source" => null
|
||||
)
|
||||
);
|
||||
|
|
Loading…
Reference in New Issue