check if client IP is empty

This commit is contained in:
Roland Gruber 2015-06-26 18:06:22 +00:00
parent 8bd5b0fe9c
commit 77a6a0d0c9
1 changed files with 13 additions and 13 deletions

View File

@ -487,7 +487,7 @@ function isLoggedIn() {
* @return String client IP (e.g. 10.10.10.10,11.11.11.11)
*/
function getClientIPForLogging() {
$ip = $_SERVER['REMOTE_ADDR'];
$ip = empty($_SERVER['REMOTE_ADDR']) ? '' : $_SERVER['REMOTE_ADDR'];
if (!empty($_SERVER['HTTP_X_FORWARDED_FOR']) && (strlen($_SERVER['HTTP_X_FORWARDED_FOR']) < 100)) {
$ip .= ',' . $_SERVER['HTTP_X_FORWARDED_FOR'];
}