Jump to content

LDAP search in groups


PatPHP

Recommended Posts

Hi

 

I already tried out many different ways but I haven't found a solution yet. I want that my ldap query just filters or search in a group in my example called 'InternetAccess'. But it still give me the student even he is not in that group. It works fine on OUs but it fails on groups.... Somebody has an idea what could be the problem?

 

    //Connect
    $ad = ldap_connect("10.0.10.10");

    //Set some variables
    ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
    ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);

    //Bind to the ldap directory
    $bd = ldap_bind($ad,"[email protected]","password")
        or die("Couldn't bind to AD!");

    //Search the directory
    $result = ldap_search($ad, "OU=Students,OU=test,DC=test,DC=edu,DC=au", "CN=InternetAccess");

    //Create result set
    $entries = ldap_get_entries($ad, $result);

    //Sort and print
    echo "User count: " . $entries["count"] . "<br /><br /><b>Users:</b><br />";

    for ($i=0; $i < $entries["count"]; $i++)
    {
        echo $entries[$i]["displayname"][0]."<br />";
    }

    //never forget to unbind!
    ldap_unbind($ad);

 

thx

pat

Link to comment
https://forums.phpfreaks.com/topic/96457-ldap-search-in-groups/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.