php AD ldap search filter specific OUS

110 views Asked by At

Here is my AD structure AD structure , running ldap query with php

ldap_set_option($ds, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ds, LDAP_OPT_REFERRALS, 0);

$term = $_GET["term"];

$rAD = ldap_bind($ds, $admin, $passwd);
$andThis="(&(cn=*$term*)(objectClass=User))";

$results1ADl = ldap_search($ds, $dn, $andThis);

$info = ldap_get_entries($ds, $results1ADl);


for ($i = 0; $i < $info["count"]; $i++) {

    $fullname[$i] = $info[$i]['cn'][0];
}

Need to exclude all OU's under "search" except for the highlighted OU's , labeled 1 and 2. what is the best method to do this?

0

There are 0 answers