0
//In my Config file (config.php)
$dn = "CN=" . $_POST['cn'] . ",OU=" . $cn . ",DC=" . $dc1. ",DC=" . $dc2;

$attributes = array("cn" , "mail" ,"sAMAccountName", "thumbnailPhoto", "url" ,  "displayName", "physicaldeliveryofficename" , "telephonenumber"    ,"mobile","ipphone","facsimiletelephonenumber","title","department");

$ad = ldap_connect($fqdn)or die("Couldn't connect to AD!");

ldap_set_option($ad, LDAP_OPT_PROTOCOL_VERSION, 3);
ldap_set_option($ad, LDAP_OPT_REFERRALS, 0);

$bd = ldap_bind($ad, $login_name, $password) or die("Couldn't bind to AD!");

有什么建议么?下面是我的代码......我需要搜索域名活动目录,而不考虑 OU 结构,以适应未来的变化,而不是硬编码 OU 过滤器。

// In my update file (update.php) 

$result = ldap_mod_replace($ad, $dn, $user);
//$result = ldap_modify($ad, $dn, $user);

if($result){ 
    //echo "User modified!";
    header("Location: personal.php?update=yes");
}

ldap_unbind($ad);

此代码拒绝为所有用户更新仅适用于活动目录树中的某些用户。

4

0 回答 0