1e versie

This commit is contained in:
2025-11-12 10:17:30 +01:00
commit 6b5f9abec7
10 changed files with 255 additions and 0 deletions

23
includes/ldap.php Normal file
View File

@@ -0,0 +1,23 @@
<?php
function ldap_authenticate($username, $password)
{
$config = require __DIR__ . '/../config/config.php';
$ldapconn = ldap_connect($config['ldap']['server']);
if (!$ldapconn) {
return false;
}
ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
$bind_dn = "uid={$username},{$config['ldap']['user_dn']}";
if (@ldap_bind($ldapconn, $bind_dn, $password)) {
ldap_unbind($ldapconn);
return true;
}
return false;
}