From c07d16f54d6479b657b2111545bd0a346cf468c3 Mon Sep 17 00:00:00 2001 From: sparkyx Date: Thu, 16 Sep 2021 09:48:53 +0200 Subject: [PATCH] Doc and audit --- include/class/user.class.php | 10 ++++++++-- include/config.inc.example | 3 +++ 2 files changed, 11 insertions(+), 2 deletions(-) diff --git a/include/class/user.class.php b/include/class/user.class.php index 45faa8091..9dbf40dad 100644 --- a/include/class/user.class.php +++ b/include/class/user.class.php @@ -108,7 +108,11 @@ class User if ($this->load()==-1) { echo '

'._('Utilisateur ou mot de passe incorrect').'

'; - + $sql="insert into audit_connect (ac_user,ac_ip,ac_module,ac_url,ac_state) values ($1,$2,$3,$4,$5)"; + $this->db->exec_sql($sql, + array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], "DISCON", + $_SERVER['REQUEST_URI'], 'FAIL')); + $this->clean_session(); redirect('logout.php', 1); exit(); } @@ -440,10 +444,12 @@ class User } else { - if ($from=='LOGIN') + if ($from=='LOGIN' || $from=='PORTAL') + { $cn->exec_sql($sql, array($_SESSION[SESSION_KEY.'g_user'], $_SERVER["REMOTE_ADDR"], $from, $_SERVER['REQUEST_URI'], 'SUCCESS')); + } $this->valid=1; } diff --git a/include/config.inc.example b/include/config.inc.example index 28eebccf0..ea16393aa 100644 --- a/include/config.inc.example +++ b/include/config.inc.example @@ -83,3 +83,6 @@ define ("DEBUGNOALYSS",0); // define ("MAX_FILE_SIZE",2097152); // Create your own SESSION_KEY // define ("SESSION_KEY","irazap492pq11"); +// +// Audit everything +// define ("AUDIT_ENABLE",true);