Hi all,

I'm trying to get started with LDAP/Active Directory and I can't seem to get a proper search result. I either get 0 entries, or I get too many entries. Here is the output of my script:
Code:
Active Directory Test
Connect result is: Resource id #2
LDAP bind successful...

Warning: ldap_search() [function.ldap-search]: Partial search results returned: Sizelimit exceeded in /home/statik/web_root/index.php on line 33
Search result is Resource id #3

----

Resource id #3

----
entries returned
and here is the code, thus far:
PHP Code:
<?php
    $ldaphost 
"cai.dnd";
    
$ldapport "3268";
    
$ldapconn ldap_connect$ldaphost )
        or die( 
"Could not connect to  ($ldaphost)" );
    
ldap_set_option($ldapconnLDAP_OPT_PROTOCOL_VERSION3);
    
ldap_set_option($ldapconnLDAP_OPT_REFERRALS0);

    echo 
"Connect result is: ".$ldapconn."<br />";
        
    
$ldapuser "admin";
    
$ldappass "*********";  //yes, I replaced the password. :)
    
if ($ldapconn) {
        
$ldapbind ldap_bind($ldapconn$ldapuser$ldappass);
        if (
$ldapbind) {
            echo 
"LDAP bind successful...<br />";
        } else {
            echo 
"LDAP bind failed...<br />";
        }
    }
    
    
$dn "dc=cai,dc=dnd";
    
$filter "(cn=*)";
    
$attributes = array("username""mail");
    
$searchresult ldap_search($ldapconn$dn$filter$attributes020)
        or die (
"Error is search query");
    echo 
"Search result is ".$searchresult."<br />";
    echo 
"<br />----<br /><pre>";
    
print_r($searchresult);
    echo 
"</pre>----<br />";
    
$info ldap_get_entries($ldapconn$searchresult);
    echo 
$info["Count"]." entries returned\n";
    
    
ldap_close($ldapconn);
?>
What am I doing wrong?

Thanks,

Statik