log des connexions à la console d'admin
This commit is contained in:
@@ -397,4 +397,15 @@ function FormateDelta(&$delta) {
|
||||
return (string)$secs.$unit;
|
||||
}
|
||||
|
||||
|
||||
// Fonction LogAdminConnexion(username)
|
||||
// Insère un enregistrement dans la table de log des connexions à la console d'administration de Winlog
|
||||
function LogAdminConnexion($username) {
|
||||
$db = db_connect();
|
||||
|
||||
$req = "INSERT INTO log_admin_connexions (username) VALUES ('".$username."')";
|
||||
db_query($db, $req);
|
||||
|
||||
}
|
||||
|
||||
?>
|
||||
|
||||
@@ -17,9 +17,17 @@ switch ($auth_mode) {
|
||||
break;
|
||||
|
||||
case "CAS":
|
||||
$log = false;
|
||||
if (!isset($_SESSION['username'])) {
|
||||
// si la session n'est pas déjà démarrée, alors il faudra logguer la première connexion
|
||||
$log = true;
|
||||
}
|
||||
// la session PHP est déjà démarrée par la lib phpCAS.
|
||||
include('libhome.php');
|
||||
$username = phpCAS::getUser();
|
||||
if ($log) {
|
||||
LogAdminConnexion($username);
|
||||
}
|
||||
break;
|
||||
|
||||
case "LDAP":
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
// Formulaire d'authentification simple
|
||||
include_once('winlog_admin_conf.php');
|
||||
include_once('connexions.php');
|
||||
include_once('password.php');
|
||||
|
||||
// on sort immédiatement si login.php est appelé hors du auth_mode simple
|
||||
@@ -15,6 +16,7 @@ $password = $_POST['password'];
|
||||
if (array_key_exists($username, $passwords) && $password == $passwords[$username]) {
|
||||
session_start();
|
||||
$_SESSION['username'] = $username;
|
||||
LogAdminConnexion($username);
|
||||
header('Location: '.$winlog_url);
|
||||
exit();
|
||||
}
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
<?php
|
||||
// Formulaire d'authentification LDAP
|
||||
include_once('winlog_admin_conf.php');
|
||||
include_once('connexions.php');
|
||||
// on sort immédiatement si login_ldap.php est appelé hors du auth_mode LDAP
|
||||
if ($auth_mode !="LDAP") {
|
||||
header('Location: interdit.php');
|
||||
@@ -41,7 +42,8 @@ if($ldapconn) {
|
||||
if (($s2) && ($password != "") && ($dn != ""))
|
||||
{
|
||||
session_start();
|
||||
$_SESSION['username'] = $username;
|
||||
$_SESSION['username'] = $username;
|
||||
LogAdminConnexion($username);
|
||||
header('Location: '.$winlog_url);
|
||||
exit();
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user