Skip to content

Commit

Permalink
use X-Forwarded-For if available for ip queries
Browse files Browse the repository at this point in the history
  • Loading branch information
applemayexist committed Aug 21, 2023
1 parent b5a9f12 commit 7cf1961
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion engines/special/ip.php
Original file line number Diff line number Diff line change
@@ -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
)
);
Expand Down

0 comments on commit 7cf1961

Please sign in to comment.