use X-Forwarded-For if available for ip queries

This commit is contained in:
Daniel Foster 2023-08-21 05:03:23 +00:00
parent b5a9f12df9
commit b1a34bc004
No known key found for this signature in database
GPG Key ID: 9A8C2923AC0ABB97
1 changed files with 7 additions and 1 deletions

View File

@ -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
)
);