Changing Active Direct Password through PHP

sujoy_mukh123
sujoy_mukh123 used Ask the Experts™
on
Hi All,

I have setup an Exchange Server with User Accounts configured in Active Directory. I have another server in OpenLDAP with quite a lot of users. A PHP application is being used for changing any fields in OpenLDAP, including User Password. The PHP Script is working perfectly fine for me for the last 2 years with OpenLDAP.

Now I want the same PHP front-end to make changes in Active Directory also. Currently I am using phpLDAP that makes changes in OpenLDAP. Is there a way I can integrate this PHP script of mine to change password (and other fields) in Active Directory?

One thing I noticed that the "ldapsearch" command returns all the fields from Active Directory, but unlike OpenLDAP, it does not give me the password atribute. If I can get the password field somehow, I can probably use "ldapmodify" command to change the passwords.

Please help.

Regards,
SaN
Comment
Watch Question

Do more with

Expert Office
EXPERT OFFICE® is a registered trademark of EXPERTS EXCHANGE®
Commented:
Use this class: http://adldap.sourceforge.net

1. Confiure the class to connect to your domain
        Lines 68, 75, 83, 92, 93
2. You must have SSL installed and turned on in the class file
3. Use code below:

I know adLDAP isn't what you currently use, but it is really good you should check it out.

Easy Hosting Solutions
http://www.HDWebStudios.com
<?PHP
require_once("adldap.php");
$username = "myname";
$attributes = array("password"=>"newpass");
$result = $adldap->user_modify($username,$attributes);
?>

Open in new window

Author

Commented:
Hi IceCode,

I am new to AD. Please let me know if this has to be executed in the AD Server or in OpenLDAP Server.

Is there a PHP Script that I can run on LDAP Server, which can make connection with AD and get the changes done? My PHP script is already changing passwords in OpenLDAP using ldap_connect and ldap_modify functions.

Regards,
SaN

Commented:
This is for Active Directory.

Do more with

Expert Office
Submit tech questions to Ask the Experts™ at any time to receive solutions, advice, and new ideas from leading industry professionals.

Start 7-Day Free Trial