gcoleman0828 Posted February 6, 2009 Share Posted February 6, 2009 Can someone please tell me if it is possible and if so, what i should be using to have the ability within PHP to change the OU that a user resides in. i tried using ldap_mod_replace using the script below: <?php $ds = ldap_connect("ri-domain01"); // assuming the LDAP server is on this host if ($ds) { // bind with appropriate dn to give update access $r = ldap_bind($ds, "CN=Authenticated User,OU=CINET,OU=Carousel Everyone,DC=CHARLESTOWN,DC=CAROUSELINDUSTRIES,DC=com", "PASSWORD"); // prepare data $info["distinguishedname"] = array("CN=Easter Bunny2,OU=Disabled accounts,OU=Other Users,DC=CHARLESTOWN,DC=CAROUSELINDUSTRIES,DC=com"); //$info["sn"] = array("Jones"); //$info["objectclass"] = array("person"); // add data to directory $r = ldap_mod_replace($ds, "CN=Easter Bunny2,OU=New_Employees,OU=Carousel Everyone,DC=CHARLESTOWN,DC=CAROUSELINDUSTRIES,DC=com", $info); echo "User Added"; ldap_close($ds); } else { echo "Unable to connect to LDAP server"; } ?> If i change the $info["distinguishedname"] to $info["mail"] and put an email address in, it updates the email field, but when i try the DN, it gives me the following error... Warning: ldap_mod_replace() [function.ldap-mod-replace]: Modify: Constraint violation in /var/www/Testing/LDAP/Testing/ldap_change_DN.php on line 15 User Added Any info would be greatly appreciated Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.