PHP修改LDAP用户密码程序
ldap.php
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en">
<head>
<title> Reset LDAP Password</title>
<style type="text/css">
dt{
font-weight: bold;
}
</style>
</head>
<body>
<?php
/*
===========================================================
ldap.php Zhu Weiwei
Copyright © 2006-2008
http://www.cncmm.com China. All Rights Reserved.
===========================================================
*/
$u = $_REQUEST['u'];
$op = $_REQUEST['op'];
$np1 = $_REQUEST['np1'];
$np2 = $_REQUEST['np2'];
$an = $_REQUEST['an'];
if(!empty($an)){
if( empty($u) or empty($op) or empty($np1) or empty($np2) ){
$msg = "Some filed was empty!";
}else{
if( $np1 != $np2 ){
$msg = "confirm password error!";
}else{
if($op == $np1){
$msg = "new password can not be same as old password!";
}else{
$ldap_host = "domain.com";
$ldap_port = 389;
$base_dn = "dc=domain,dc=com";
$connect = @ldap_connect( $ldap_host, $ldap_port);
if(!$connect){
$msg = "Could not connect to LDAP server";
}else{
$user_dn = sprintf("uid=%s,ou=Staff,dc=domain,dc=com",$u);
相关新闻>>
- 发表评论
-
- 最新评论 更多>>