note 44683 added to function.ldap-rename

From: Date: Thu, 12 Aug 2004 22:21:49 +0000
Subject: note 44683 added to function.ldap-rename
Groups: php.notes 
Request: Send a blank email to php-notes+get-79932@lists.php.net to get a copy of this message
When setting a new Rdn value be sure to escape any commas that are not path designators. I spent several hours trying to move user nodes in AD since their cn was set wrong. We wanted the cn to be set to: lastname, firstname. <?php //In this example we are renaming a node with cn of "jsmith" to "Smith, John" /* Setting some variables to values for display purposes. In a real script the values would probably come from some outside source (file, ldap query, etc...) */ $dn = 'cn=jsmith,ou=mygroup,dc=mydomain'; $name = "Smith, John"; // Now replace those pesky commas $newRdn = "cn=" . str_replace(",", "\\,", $name); ldap_rename($link, $dn, $newRdn, $newParent, true); ?> ---- Manual Page -- http://www.php.net/manual/en/function.ldap-rename.php Edit -- http://master.php.net/manage/user-notes.php?action=edit+44683 Delete -- http://master.php.net/manage/user-notes.php?action=delete+44683&report=yes Reject -- http://master.php.net/manage/user-notes.php?action=reject+44683&report=yes Search -- http://master.php.net/manage/user-notes.php

« previous php.notes (#79932) next »