使用PHP重置LDAP密码

Fre*_*ber 1 php

如何在PHP中重置LDAP密码?
我已经连接到LDAP服务器了.

Ste*_* P. 6

请尝试以下代码:

$dn = "uid=".$username.",dc=example,dc=com";
$newPassword = ...;
$newEntry = array('userpassword' => "{MD5}".base64_encode(pack("H*",md5($newPassword))));

if(ldap_mod_replace($ldapConnection, $dn, $newEntry))
    print "<p>succeded</p>";
else
    print "<p>failed</p>";
Run Code Online (Sandbox Code Playgroud)

看到:

http://php.net/manual/en/function.ldap-mod-replace.php

http://logout.sh/computers/ldap/