Active DirectoryとPHPの統合については本当に苦労しています。私が更新しようとしているフィールドは、givenname、sn、mail、telephonenumber、company、department、titleです。私は、私が代わりにLDAPのLDAPSを使用する必要があることを発見したインターネットを検索することから警告:ldap_modify():変更:サーバの実行が望ましくない
Warning: ldap_modify(): Modify: Server is unwilling to perform in E:\IIS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
が、私はここで間違って何であるかわからない:それは私に次のエラーを与えている
function get_active_directory_info($username, $password)
{
$conn = ldap_connect("DC-1");
if($conn==FALSE)
{
return array(FALSE, FALSE);
}
else
{
$bind = ldap_bind($conn, $username, $password);
ldap_set_option($conn, LDAP_OPT_PROTOCOL_VERSION,3);
ldap_set_option($conn, LDAP_OPT_REFERRALS,0);
$unit = "OU=Staff,OU=Users,DC=example,DC=internal";
$filter = "(&(objectCategory=person)(sAMAccountName=*)(!(UserAccountControl=514)))";
$results = array();
$justthese = array("sn", "givenname", "mail", "company","department","title","telephonenumber","samaccountname", "cn");
$sr=ldap_search($conn, $unit, $filter, $justthese);
$info = ldap_get_entries($conn, $sr);
for($i = 0; $i < $info["count"]; $i++)
{
$cn = $info[$i]["cn"][0];
if(substr($cn, -3) != "ADM")
{
$results[$i]["id"] = $i + 1;
if(empty($info[$i]["givenname"][0])==FALSE)
{
$results[$i]["first"] = $info[$i]["givenname"][0];
}
if(empty($info[$i]["sn"][0])==FALSE)
{
$results[$i]["last"] = $info[$i]["sn"][0];
}
if(empty($info[$i]["mail"][0])==FALSE)
{
$results[$i]["email"] = $info[$i]["mail"][0];
}
if(empty($info[$i]["company"][0])==FALSE)
{
$results[$i]["company"] = $info[$i]["company"][0];
}
if(empty($info[$i]["title"][0])==FALSE)
{
$results[$i]["title"] = $info[$i]["title"][0];
}
if(empty($info[$i]["department"][0])==FALSE)
{
$results[$i]["department"] = $info[$i]["department"][0];
}
if(empty($info[$i]["telephonenumber"][0])==FALSE)
{
$results[$i]["number"] = $info[$i]["telephonenumber"][0];
}
if(empty($info[$i]["samaccountname"][0])==FALSE)
{
$results[$i]["username"] = $info[$i]["samaccountname"][0];
}
}
}
}
return $results;
}