Merge branch 'master' of https://github.com/mauricemeyer/pdnsmanager into mauricemeyer-master
This commit is contained in:
commit
01ca1ca62c
|
@ -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