'LDAP PHP DN OU Filter

I made a page that by entering the name AD groups, it print the names of the user inside it.

With this structure it works:

$LDAP_DN = "OU=Gruppi,OU=Brevetti,OU=Others,dc=xxx,dc=xxx";
$filter="(&(objectClass=user)(objectCategory=person)(memberof=CN="groupName"," . $LDAP_DN . "))";

By this way, I am searching groupName under this path in OU: Others -> Brevetti -> Gruppi. And it returns the list of the users in this group.

How can I modify this filter for searching the groupName under the main directory "Others"?

Because the user that can search a group doesn't know in which path it exist.

Hope I am clear.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source