check for HTTP_X_FORWARDED_FOR in add_log_line()

use it instead of REMOTE_ADDR
This commit is contained in:
Uwe Steinmann 2016-08-03 08:53:14 +02:00
parent fdd369f8ec
commit 06347ff212

View File

@ -322,10 +322,14 @@ function add_log_line($msg="", $priority=null) { /* {{{ */
if(!$logger) return;
if($user)
$logger->log($user->getLogin()." (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority);
if(!empty($_SERVER['HTTP_X_FORWARDED_FOR']))
$ip = $_SERVER['HTTP_X_FORWARDED_FOR'];
else
$logger->log("-- (".$_SERVER['REMOTE_ADDR'].") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority);
$ip = $_SERVER['REMOTE_ADDR'];
if($user)
$logger->log($user->getLogin()." (".$ip.") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority);
else
$logger->log("-- (".$ip.") ".basename($_SERVER["REQUEST_URI"], ".php").$msg, $priority);
} /* }}} */
function _add_log_line($msg="") { /* {{{ */