Hi all 🙂
How can i perform a query for existe username and valid password , I found this example but i don't know what is DC,CN etc ..
<?php
$ldapServer = '127.0.0.1';
$ldapBase = 'DC=anlx,DC=net';
/*
* try to connect to the server
*/
$ldapConn = ldap_connect($ldapServer);
if (!$ldapConn)
{
die('Cannot Connect to LDAP server');
}
/*
* bind anonymously
*/
$ldapBind = ldap_bind($ldapConn);
if (!$ldapBind)
{
die('Cannot Bind to LDAP server');
}
/*
* set the ldap options
*/
ldap_set_option($ldapConn, LDAP_OPT_PROTOCOL_VERSION, 3);
/*
* search the LDAP server
*/
$ldapSearch = ldap_search($ldapConn, $ldapBase, "(cn=*)");
$ldapResults = ldap_get_entries($ldapConn, $ldapSearch);
for ($item = 0; $item < $ldapResults['count']; $item++)
{
for ($attribute = 0; $attribute < $ldapResults[$item]['count']; $attribute++)
{
$data = $ldapResults[$item][$attribute];
echo $data.": ".$ldapResults[$item][$data][0]."<br>";
}
echo '<hr />';
}
?>