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 Link to comment https://forums.phpfreaks.com/topic/144101-active-directory-with-php-changing-you-dn-or-moving-ous/ Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.