Hi,
I am trying to write a script that will allow users within the Windows 2000
Active Directory to be able to change thier personal details on an intranet
website. I have included the script I am using below.
The first part of the script commented as "Search Script" works flawlessly,
even though $base_dn is not set. The problem I am having is with the "Modify
Script", when I try and modify a field it returns with the error:
Warning: ldap_modify(): Modify: Server is unwilling to perform in change.php
on line xx
Is there something in AD that stops ldap_modify? Is my problem with the
unset $base_dn? I had left the $base_dn blank, as I had no idea what it
should be. I would appreciate any help, comments or suggestions.
Thanks!
Phil Dowson
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ Script Below \/ \/ \/
\/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/ \/
<?
$base_dn = '';
$ldappass = 'mypassword';
$ldaprdn = 'AD\\'.$ldapuser;
$ldapconn = @ldap_connect("ad.domain.com", 3268);
//Search Script Start
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
$filter="samaccountname=$ldapuser";
$justthese = array("samaccountname", "info");
$read = ldap_search($ldapconn, $base_dn, $filter, $justthese);
$info = ldap_get_entries($ldapconn, $read);
//Search Script End
//Modify Script Start
$info = $_POST["info"];
@ldap_set_option($ldapconn, LDAP_OPT_PROTOCOL_VERSION, 3);
@ldap_set_option($ldapconn, LDAP_OPT_REFERRALS, 0);
if ($ldapconn) {
$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);
}
$newinfo["notes"][0]=$notes;
ldap_modify($ldapconn, $base_dn, $newinfo);
//Modify Script End
?>
/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ Script Above /\ /\ /\
/\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\ /\
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php