Merge branch 'master' of https://github.com/mauricemeyer/pdnsmanager into mauricemeyer-master
This commit is contained in:
commit
01ca1ca62c
1 changed files with 9 additions and 2 deletions
|
@ -59,7 +59,14 @@ if(filter_input(INPUT_SERVER, "REQUEST_METHOD") == "GET") {
|
|||
echo json_encode($return);
|
||||
exit();
|
||||
} 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);
|
||||
exit();
|
||||
}
|
||||
|
@ -150,4 +157,4 @@ if(filter_input(INPUT_SERVER, "REQUEST_METHOD") == "GET") {
|
|||
echo json_encode($return);
|
||||
exit();
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue