need to display info for user within active-directory
- by Brad
The following code will search for the user within the domain controller, but I want to display the info of each thing noted within the justthese variable: "displayname","mail","samaccountname","sn","givenname","department","telephonenumber"
$dn = "dc=xxx,dc=xxx";
$justthese = array("displayname","mail","samaccountname","sn","givenname","department","telephonenumber");
$sr=ldap_search($ldapconn, $dn,'SAMAccountName=username', $justthese);
$info = ldap_get_entries($ldapconn, $sr);
echo "<h3>".$info["count"]." entries returned</h3>";
foreach($justthese as $key=>$value){
print '<p><strong>'.$value.'</strong></p>';
}
It displays each item within the $justthese array, I want to display the info for that user for each thing noted in $justthese array.
Right now it outputs it like this:
displayname
mail
samaccountname
sn
givenname
department
telephonenumber
I want it to have the actual data to the right of it, which I know I am doing something wrong with the foreach loop, any help is appreciated.
So it'd look like this
displayname Chuck
mail [email protected]
samaccountname chucknorris
sn chuckisthebest
givenname Chuck Norris
department Security
telephonenumber 555-555-5555