Merge branch 'master' of https://github.com/mauricemeyer/pdnsmanager into mauricemeyer-master

This commit is contained in:
Lukas Metzger 2016-04-20 16:08:19 +02:00
commit 01ca1ca62c

View file

@ -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();
}
}
}