Over a million developers have joined DZone.
{{announcement.body}}
{{announcement.title}}

PHP - Change Active Directory Password

DZone's Guide to

PHP - Change Active Directory Password

·
Free Resource


  You are changing the password for  ". $info[$i]["givenname"][0] .", " . $info[$i]["sn"][0] ." (" . $info[$i]["samaccountname"][0] .") to " . $_POST['user_pass'] ."

\n"; $passwd1 = $_POST['user_pass']; $userDn = $info[$i]["distinguishedname"][0]; $newPassword = $passwd1; $newPassword = "\"" . $newPassword . "\""; $len = strlen($newPassword); for ($i = 0; $i < $len; $i++){ $newPassw .= "{$newPassword{$i}}\000";} $newPassword = $newPassw; $userdata["unicodePwd"] = $newPassword; $result = ldap_mod_replace($ldap, $userDn , $userdata); if ($result) echo "Your password has been changed!" ; else echo "There was a problem changing your password, please call IT for help"; } } @ldap_close($ldap); ?>
Topics:

Opinions expressed by DZone contributors are their own.

THE DZONE NEWSLETTER

Dev Resources & Solutions Straight to Your Inbox

Thanks for subscribing!

Awesome! Check your inbox to verify your email so you can start receiving the latest in tech news and resources.

X

{{ parent.title || parent.header.title}}

{{ parent.tldr }}

{{ parent.urlSource.name }}