Skip to content

Commit 58d8b96

Browse files
committed
use X-Forwarded-For if available for ip queries
1 parent b5a9f12 commit 58d8b96

File tree

1 file changed

+7
-1
lines changed

1 file changed

+7
-1
lines changed

engines/special/ip.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,15 @@
11
<?php
22
function ip_result()
33
{
4+
$ip = $_SERVER["REMOTE_ADDR"];
5+
6+
if (isset($_SERVER["HTTP_X_FORWARDED_FOR"])) {
7+
$ip = reset(explode(",", $_SERVER["HTTP_X_FORWARDED_FOR"]));
8+
}
9+
410
return array(
511
"special_response" => array(
6-
"response" => $_SERVER["REMOTE_ADDR"],
12+
"response" => $ip,
713
"source" => null
814
)
915
);

0 commit comments

Comments
 (0)