ldap_mod_add help

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • fouadk
    New Member
    • Jul 2008
    • 5

    #1

    ldap_mod_add help

    hi everyone...

    i am trying to add users to a windows active directory server using a php script....

    my script is the following:
    Code:
    <?php
    
    $dn = "OU=students,OU=users,DN=ozz,DN=example,DN=com";
    
        $ad = ldap_connect("172.16.50.7")
              or die("Couldn't connect to AD!");
    
        ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
    
        $bd = ldap_bind($ad,"Administrator@ozz.example.com","password")
              or die("Couldn't bind to AD!");
    
        $user["givenname"] = "Jason";
        $user["sn"] = "Gilmore";
        $user["mail"][] = "jason@wjgilmore.com";
    
        $result = ldap_mod_add($ad, $dn, $user);
    
        if ($result) echo "User added!"; else echo "failed";
    
        ldap_unbind($ad);
    
    ?>
    the following script gives the following error:

    Code:
     
    Warning: ldap_mod_add() [function.ldap-mod-add]: Modify: Operations error in /var/www/test.php on line 17
    please help

    thanks in advance
Working...