Problem LDAP and Win2003 AD

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • User79

    #1

    Problem LDAP and Win2003 AD

    Hello!
    I'm trying simple scripts to browse an Active Directory via LDAP
    functions...
    My domain is: schoollm.lan

    The script I'm trying:

    ----------
    $root_dn = "administrator@ mascheroni.lan" ;
    $root_pw = "secret";

    $conn = ldap_connect("1 92.168.10.1") or die("Could not connect to
    server");

    ldap_set_option ($conn, LDAP_OPT_PROTOC OL_VERSION, 3);

    $r = ldap_bind($conn , $root_dn, $root_pw) or die("Could not bind to
    server");

    $result = ldap_search($co nn,"dc=schoollm , dc=lan","(cn=*) ") or die
    ("Error in search query");

    $info = ldap_get_entrie s($conn, $result);

    for ($i=0; $i<$info["count"]; $i++)
    {
    echo "dn is: ". $info[$i]["dn"] ."<br>";
    echo "first cn is: ". $info[$i]["cn"][0] ."<br>";
    echo "first email address is: ". $info[$i]["mail"][0] ."<p>"; }

    echo "Number of entries found: " . ldap_count_entr ies($conn, $result)

    ldap_close($con n);
    ----------

    I always get this error:

    Warning: ldap_search(): Search: Operations error in
    C:\Programmi\Ap ache Group\Apache2\h tdocs\ldap.php on line 12
    Error in search query

    Where I'm wrong?
    THANKS!
Working...