我正在开发一个使用令牌更改用户AD密码的项目。如何仅使用 EMAIL 用户找到 DN 用户?
换句话说,我有用户的电子邮件,我想获得用户DN。
$result = ldap_mod_replace($ds, $UserDN , $userdata);
$ds = connection to ldap "Already done"
$userdata = User new password"Already done"
$UserDN = That's what I have the problem.
真的,谢谢你们。 :)
答案 0 :(得分:0)
问题解决了!
代码:
$res = ldap_search($ds, $basedn, $filter);
$first = ldap_first_entry($ds, $res);
$data = ldap_get_dn($ds, $first);
echo "The desired DN is: ".$data;
$userdata['unicodePwd'] = iconv('UTF-8', 'UTF-16LE',"\"" . $password1 . "\"");
$result = ldap_mod_replace($ds, $data , $userdata);