diff --git a/functions/logging.php b/functions/logging.php new file mode 100644 index 0000000..db159a3 --- /dev/null +++ b/functions/logging.php @@ -0,0 +1,28 @@ +prepare( + "INSERT INTO log (gebruiker, actie, extra) VALUES (:gebruiker, :actie, :extra)" + ); + return $stmt->execute([ + ':gebruiker' => $gebruiker, + ':actie' => $actie, + ':extra' => $extra + ]); + } catch (PDOException $e) { + error_log("Logging fout: " . $e->getMessage()); + return false; + } +} diff --git a/test_ldap.php b/test_ldap.php index efda1bb..4a2ff90 100644 --- a/test_ldap.php +++ b/test_ldap.php @@ -1,5 +1,7 @@ Email: " . htmlspecialchars($user['email']) . ""; echo "
  • UserPrincipalName: " . htmlspecialchars($user['userPrincipalName']) . "
  • "; echo ""; + + // Log de succesvolle login + log_action($pdo, $user['username'], 'Inloggen via LDAP', 'Test-login script'); } else { echo "

    ❌ Ongeldige inloggegevens.

    "; + // Optioneel log mislukte login + log_action($pdo, $username, 'Mislukte login via LDAP', 'Test-login script'); } } ?>