note 52292 added to function.ldap-mod-replace
| From: | rickymix at gmail dot com | Date: | Wed, 27 Apr 2005 09:05:42 +0000 |
| Subject: | note 52292 added to function.ldap-mod-replace | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-88610@lists.php.net to get a copy of this message | ||
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
----
Manual Page -- http://www.php.net/manual/en/function.ldap-mod-replace.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+52292
Delete: added to the manual -- http://master.php.net/manage/user-notes.php?action=delete+52292&report=yes&reason=added+to+the+manual
Delete: bad code -- http://master.php.net/manage/user-notes.php?action=delete+52292&report=yes&reason=bad+code
Delete: spam -- http://master.php.net/manage/user-notes.php?action=delete+52292&report=yes&reason=spam
Delete: useless -- http://master.php.net/manage/user-notes.php?action=delete+52292&report=yes&reason=useless
Delete: other reasons -- http://master.php.net/manage/user-notes.php?action=delete+52292&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+52292&report=yes
Search -- http://master.php.net/manage/user-notes.php