LDAP

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Okay, hopefully someone can help me out here.  I've gone over ldap at
php.net and multiple other sites but can't get it to work. Everytime I run
the query my results are "0 entries returned".

My AD tree is: CN=Users,DC=domain,DC=us.  I have the AD Server set so that
anonymous access to retrieve information is enabled.

Below is my code.  Any ideas?


<?php
    $ldap_host = "AD Server";
    $ldap_port = "389";
    $base_dn = "DC=domain,DC=us";
    $filter = "(CN=users)";
    $connect = ldap_connect( $ldap_host, $ldap_port);
    ldap_set_option($connect, LDAP_OPT_PROTOCOL_VERSION, 3);

    $bind = ldap_bind($connect);
    $read = ldap_search($connect, $base_dn, $filter);

    $info = ldap_get_entries($connect, $read);
    echo $info["count"]." entries returned<BR><BR>";
    for($row = 0; $row<$info["count"]; $row++)
    {
        for($column = 0; $column<$info[$row]["count"]; $column++)
        {
            $data = $info[$row][$column];
            echo $data.":".$info[$row][$data][0]."<BR>";
        }
        echo "<BR>";
    }
ldap_close($connect);
?>

[Index of Archives]     [PHP Home]     [Apache Users]     [PHP on Windows]     [Kernel Newbies]     [PHP Install]     [PHP Classes]     [Pear]     [Postgresql]     [Postgresql PHP]     [PHP on Windows]     [PHP Database Programming]     [PHP SOAP]

  Powered by Linux