1
you could try something along these lines
Not very elegant but just an idea
When you call that function you'll get an array of strings to pump into ldap_search( )
I'll bet there is a better way to do this but the above idea would work in a pinch.
Alternately you could objectify the whole scenario to spit custom base dn objects into whatever function the ldap_search() has been wrapped in
Not very elegant but just an idea
//This is just a very basic rough code idea.
//You will have to come up with a precise solution
//That fits your situation
//This is untested code!
function getBaseDnArray(){
$ouArray = array();
//add your OU's here
$ouArray[] = "IT";
$ouArray[] = "ACCOUNTING";
$ouArray[] = "SHIPPING";
$baseDnArray = array();
for($x=0;$x<count($ouArray);$x++){
$base_dn[$x] = "OU=".$ouArray[$x].",O=org.example.com";
}
return $baseDnArray;
}
When you call that function you'll get an array of strings to pump into ldap_search( )
I'll bet there is a better way to do this but the above idea would work in a pinch.
Alternately you could objectify the whole scenario to spit custom base dn objects into whatever function the ldap_search() has been wrapped in