ciao ri-eccomi, ho visto sulla guida php.net questo script:
Codice PHP:
$ldap_url = 'examplead.mycomp.com';
$ldap_domain = 'mycomp.com';
$ldap_dn = "dc=mycomp,dc=com";
$ds = ldap_connect( $ldap_url );
ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);
$username = "your_user_name_here";
//must always check that password length > 0
$password = "your_password_here";
// now try a real login
$login = ldap_bind( $ds, "$username@$ldap_domain", $password );
echo '- Logged In Successfully
';
try{
$attributes = array("displayname", "mail",
"department",
"title",
"physicaldeliveryofficename",
"manager");
$filter = "(&(objectCategory=person)(sAMAccountName=$username))";
$result = ldap_search($ds, $ldap_dn, $filter, $attributes);
$entries = ldap_get_entries($ds, $result);
if($entries["count"] > 0){
//echo print_r($entries[$i],1)."
";
echo "[b]User Information:[/b]
";
echo "displayName: ".$entries[0]['displayname'][0]."
";
echo "email: ".$entries[0]['mail'][0]."
";
echo "department: ".$entries[0]['department'][0]."
";
echo "title: ".$entries[0]['title'][0]."
";
echo "office: ".$entries[0]['physicaldeliveryofficename'][0]."
";
//echo "manager: ".$entries[$i]['manager'][0]."
";
$manager_result = ldap_search($ds,
$entries[0]['manager'][0],
'(objectCategory=person)',
array("displayname"));
$manager_entries = ldap_get_entries($ds, $manager_result);
if($manager_entries["count"] > 0){
echo "manager: ". $manager_entries[0]['displayname'][0];
}
}
}catch(Exception $e){
ldap_unbind($ds);
return;
}
ldap_unbind($ds);
echo '
- Logged Out';
questo fa al caso mio?
grazie ancora...