I have a working script that allows me to unlock a user account (by setting the AD time lock attribute to 0) something like this:
$entry["lockouttime"][0]=0; $mod=ldap_mod_replace($ds,$dn,$entry)
Now I would like to do the opposite: lock the account. I read that lockouttime is a system attribute, and the active directory does not allow us to set its value to something else that is 0.
So, I am trying to associate a server with a user account and a wrong password, but this does not work.
for($i=0;$i<10;$i++){ ldap_bind($ds,$dn, "theWrongPasswd"); }
starting this operation will show this error
Warning: ldap_bind(): Unable to bind to server: Invalid credentials
but the account is still unlocked.
Do you have any ideas on how I can do this? Thanks in advance.
php active-directory
Loïc MICHEL
source share