Merge branch 'mauricemeyer-master'
This commit is contained in:
commit
b0e53d92a0
|
@ -59,7 +59,14 @@ if(filter_input(INPUT_SERVER, "REQUEST_METHOD") == "GET") {
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
exit();
|
exit();
|
||||||
} else if(filter_input(INPUT_GET, "action") == "getIp") {
|
} else if(filter_input(INPUT_GET, "action") == "getIp") {
|
||||||
$return['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR");
|
// If we are behind a proxy, return the first IP the request was forwarded for.
|
||||||
|
if(filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR") != null){
|
||||||
|
$return['ip'] = explode(",", filter_input(INPUT_SERVER, "HTTP_X_FORWARDED_FOR"))[0];
|
||||||
|
|
||||||
|
} else {
|
||||||
|
$return['ip'] = filter_input(INPUT_SERVER, "REMOTE_ADDR");
|
||||||
|
}
|
||||||
|
|
||||||
echo json_encode($return);
|
echo json_encode($return);
|
||||||
exit();
|
exit();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue