我正在使用以下代码,但我不断获得“服务器不愿意执行”,而根本不了解代码中要更改的内容。我的代码一切似乎都很好。请告诉我是否有任何改变。
$cfg = $this->app->config;
$ad = new Ldap("ldaps://" . $cfg['ad']['server']);
$ad->set_option(LDAP_OPT_PROTOCOL_VERSION, 3);
$ad->set_option(LDAP_OPT_REFERRALS, 0);
$b = $ad->bind($cfg['ad']['binddn'], $cfg['ad']['bindpassword']);
$r = $ad->search($cfg['ad']['user_basedn'],"sAMAccountName=".$this->uid);
$dn = $r[0]["dn"];
$newPassword = "\"" . $password . "\"";
$len = strlen($newPassword);
for ($i = 0; $i < $len; $i++){
$newPassw .= "{$newPassword{$i}}\000";}
$newPassword = $newPassw;
$userdata["unicodePwd"] = $newPassword;
$userdata["pwdLastSet"] = -1;
$userdata["userAccountControl"] = 512;
$result = $ad->mod_replace($dn , $userdata);
$ad_error = $ad->error();
$ad_error_no = $ad->errno(); // here getting 53