Fixed ip not defined as guest

This commit is contained in:
Rooty 2021-04-30 10:16:09 +02:00
parent 25c61ad798
commit def29edb0d

View File

@ -556,7 +556,7 @@ var $currentCoordinationObject=null;
$GLOBALS["SYSTEM_USER_SESSION"]->doLoadFromUserId($id);
/* Connexion efféctuée...... */
// $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",1";
$message="auth-success: ".date("Y-m-d H:i:s")." Authentication success for user ".$login." from ".$clientIp.". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().", EntryNodeId is eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.", NodeId is nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId;
$message="auth-success: ".date("Y-m-d H:i:s")." Authentication success for user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().", EntryNodeId is eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.", NodeId is nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId;
$file= $CONF_AUTH_FILE;
if (isset($HTTP_REFERER))
if (strpos($HTTP_REFERER, $SERVER_NAME)===false)
@ -577,18 +577,18 @@ var $currentCoordinationObject=null;
}
}else{
/* Tentative de connexion */
$clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
// $clientIp=isset($_SERVER['HTTP_CLIENT_IP']) ? $_SERVER['HTTP_CLIENT_IP'] : isset($_SERVER['HTTP_X_FORWARDED_FOR']) ? $_SERVER['HTTP_X_FORWARDED_FOR'] : $_SERVER['REMOTE_ADDR'];
if ($GLOBALS["SYSTEM_USER_SESSION"]->isNew==true)
{
// $message="log:".$login.",".date("Y-m-d H:i:s").",uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId().",eid:".$GLOBALS["SYSTEM_USER_SESSION"]->entryNodeId.",nid:".$GLOBALS["SYSTEM_USER_SESSION"]->navigationNodeId.",0";
$message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$clientIp.". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId();
$message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId();
addToLog( $message, $CONF_MESSAGE_FILE );
} else {
$file= $CONF_AUTH_FILE;
if (isset($HTTP_REFERER))
if (strpos($HTTP_REFERER, $SERVER_NAME)===false)
$file= $CONF_AUTH_ALIEN_FILE;
$message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$clientIp.". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId();
$message="auth-failed: ".date("Y-m-d H:i:s")." Authentication attempt with user ".$login." from ".$GLOBALS['SYSTEM_IP'].". Session is uid:".$GLOBALS["SYSTEM_USER_SESSION"]->user->getId();
addToLog( $message, $file );
}
// if(file_exists("/usr/local/sbin/xmpp_notification.py"))