B
B
Blumfontein2014-04-23 12:51:41
PHP
Blumfontein, 2014-04-23 12:51:41

How to change the password on Active Directory in PHP?

Good afternoon, tell me how to change user passwords through php ldap? I looked on the Internet, copy-paste of the same 2 options goes everywhere:
1)

$newPassword = "\"new_password\"";
$newPassw = '';
$len = strlen($newPassword);
for ($i = 0; $i < $len; $i++)
            $newPassw .= "{$newPassword{$i}}\000";

$newPassword = $newPassw;
$data["unicodePwd"] = $newPassword;

2)
$data['userPassword'] = "{SHA}" . base64_encode( pack( "H*", sha1( 'new_password' ) ) );

But they don't work. In the first case, the error Server is unwilling to perform falls out, and in the second, nothing happens, but the password does not change.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
1
1, 2014-04-23
1

Well, as the simplest option, you can simply try to pull through exec () dsmod with parameters.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question