PHP修改LDAP用户密码程序(2)
$user_pass = $op;
$bind = @ldap_bind($connect, $user_dn, $user_pass);
if(!$bind){
$msg = "old password error!";
}else{
$root_dn = "cn=Manager,dc=domain,dc=com";
$root_pass = 'noPa$$w0rd#';
$bind = @ldap_bind($connect, $root_dn, $root_pass);
if(!$bind){
$msg = "Programe can not bind to LDAP server!";
}else{
$values["userPassword"][0] = "{md5}".base64_encode(pack("H*",md5($np1)));
$rs = @ldap_mod_replace($connect,$user_dn,$values);
if($rs){
$msg = "password modifed success!";
}else{
$msg = "password modifed failed!";
相关新闻>>
- 发表评论
-
- 最新评论 更多>>