[Date Prev][Date Next] [Chronological] [Thread] [Top]

Re: modify DNs in PHP



You can't do this directly with PHP, but you can do it pretty easily with a few lines of code (watch my syntax it may not be perfect): $filter = "(objectclass=*)"; $basedn = "cn=john,ou=marketing,dc=company,dc=country"; $server = "servername"; $bindas = "name"; $bindpassword = "password"; $Server = ldap_connect.... $bind = ldap_bind(.... $searchresult = ldap_search($Server, $basedn, $filter); $info = get_ldap_entries($Server,$searchresult); $newdn = "cn=john,ou=support,dc=company,dc=country"; $newinfo = $info[0]; $newinfo["dn"] = $newdn; $addresult = ldap_add ($Server, $newdn, $newinfo); $delresult = ldap_delete($Server, $info[0]["dn"]); That should more or less do what you need (once the syntax is cleaned up :)). Dan Tomas Kucera wrote: hi, does anybody know how to change DNs to another one? I have this dn: cn=john,ou=marketing,dc=company,dc=country and I would change it to: cn=john,ou=support,dc=company,dc=country but when I dont know how to do it in php there is a function ldap_modify but its seems to work only with common attributes. thanks -- -------------------------------------------------------------------------- (o> Tomas Kucera (kuca) student 6.rocniku FEL CVUT // \ tom.kucera@sh.cvut.cz, tomas@globe.cz V_/_ ICQ: 33297193, TEL: 0604 704983 http://symuro.webzdarma.cz -------------------------------------------------------------------------- Linux is like fantasy game: you can kill zombies and invoke daemons -------------------------------------------------------------------------- -- Daniell Freed Computer Services Dewitt, Ross, & Stevens S.C. He who fights with monsters might take care lest he thereby become a monster. And if you gaze for long into an abyss, the abyss gazes also into you. Beyond Good and Evil Friedrich Wilhelm Nietzche