note 52292 rejected from function.ldap-mod-replace by nlopess
| From: | nlopess@php.net | Date: | Wed, 27 Apr 2005 13:50:39 +0000 |
| Subject: | note 52292 rejected from function.ldap-mod-replace by nlopess | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-88627@lists.php.net to get a copy of this message | ||
Note Submitter: rickymix at gmail dot com
----
I am trying to change user password from a LDAP but errors appears when I test this code :
$entry = ldap_first_entry($ldap, $search);
if (!is_resource($entry))
{
exit('Couldn\'t get entry');
}
$userDn = ldap_get_dn($ldap, $entry);
// Check Pwds not really used in this script but...
if ($passwd1 == $passwd2){
// prepare data
$newPassword = $passwd1;
$newPassword = "\"" . $newPassword . "\"";
$len = strlen($newPassword);
for($i = 0; $i < $len; $i++)
{
$newPassw .= "{$newPassword{$i}}\000";
}
$newPassword = $newPassw;
$userdata['unicodepwd'] = $newPassword;
echo "<------------ Changing Password --------------><br><br>";
echo "User login ID = ".$uid."<br>";
echo "User DN = $userDn<br>";
echo "Userdata = $newPassword<br>";
$result = ldap_mod_replace($ldap, $userDn , $userdata);
if($result)
{
echo "User modified!<br>" ;
}else{
echo "There was a problem!<br>";
echo ldap_error($ldap)."<br>";
}
The error appears when the function LDAP_MOD_REPLACE
trying to change password.
this is the error :
Warning: ldap_mod_replace(): Modify: Object class violation in D:\AD\test_messagerie.php on line ...
There was a problem!
Object class violation
Thanks