Ich habe wirklich Probleme mit der Integration zwischen Active Directory und PHP. Die Felder, die ich zu aktualisieren versuche, sind: Vorname, Sn, Mail, Telefonnummer, Firma, Abteilung und Titel. Es gibt mir die folgende Fehlermeldung:Warnung: ldap_modify(): Ändern: Server ist nicht bereit
Warning: ldap_modify(): Modify: Server is unwilling to perform in E:\IIS^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
Von der Suche im Internet habe ich gefunden, dass ich LDAPS anstelle von LDAP verwenden, aber ich weiß nicht, was falsch ist hier:
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;
}