tema "hardcore", le estensioni LDAP!
ho provato con il seguente codice ma nn funziona, nn riesce a fare il binding!
qualcuno lo ha già fatto per caso?
Codice PHP:
<?
$ldap_server = "ldap://losa";
$auth_user = "username";
$auth_pass = "password";
// Set the base dn to search the entire microsoft.com directory.
$base_dn = "DC=lombardi, DC=ch";
/* filter the search for all people in the microsoft.com tree that have a name that matches any one of the following attributes name, displayname, or cn. */
$filter = "(&(objectClass=user)(objectCategory=person)
(|(name=*)(displayname=*)(cn=*)))";
// connect to server
if (!($connect=@ldap_connect($ldap))) {
die("Could not connect to ldap server");
}
// bind to server
if (!($bind=@ldap_bind($connect, $auth_user, $auth_pass))) {
die("Unable to bind to server");
}
// search active directory
if (!($search=@ldap_search($connect, $base_dn, $filter))) {
die("Unable to search ldap server");
}
$number_returned = ldap_count_entries($connect,$search);
$info = ldap_get_entries($connect, $search);
echo "The number of entries returned is ". $number_returned;
for ($i=0; $i<$info["count"]; $i++) {
echo "Name is: ". $info[$i]["name"];
echo "Display name is: ". $info[$i]["displayname"][0];
echo "Email is: ". $info[$i]["mail"][0];
echo "Telephone number is: ". $info[$i]["telephonenumber"][0];
}
?>