- Joined
- Sep 3, 2006
- Messages
- 1
- Reaction score
- 0
Hi,
We are running LDAP on our OS X 10.4 machine to authenticate users on our network of some 900 users. Our intranet which used to authenticate via a Mysql database, now authenticate via LDAP, which is great as it is less work for me to do! However, using PHP, I would like to allow users to change their passwords if they so choose, but I just can't seem to get this working. Below is my code, and below my code is the result from running this code. If someone could help me out here, I would be most grateful. Thanks
The result from running this code:
connected
Bind successful
The entry couldnt be modified
We are running LDAP on our OS X 10.4 machine to authenticate users on our network of some 900 users. Our intranet which used to authenticate via a Mysql database, now authenticate via LDAP, which is great as it is less work for me to do! However, using PHP, I would like to allow users to change their passwords if they so choose, but I just can't seem to get this working. Below is my code, and below my code is the result from running this code. If someone could help me out here, I would be most grateful. Thanks
Code:
$username = justme;
$passwd = testpass;
$ds=ldap_connect("xxx.xx.xxx.x");
if(!$ds)
{
print "Cannot authenticate at this time...please try again soon";
exit(0);
}
else
{
print "<br>connected";
$newpass = "skydive";
$username = "$username";
$base_dn = "cn=users, dc=directory,dc=xxx,dc=xx,dc=xx";
$rdn = "uid=$username, " . $base_dn;
ldap_set_option($ldap_connect, LDAP_OPT_PROTOCOL_VERSION, 3);
$ldapbind = ldap_bind($ds, $rdn, $upasswd);
if ($ldapbind)
{
echo "<p>Bind successful";
if(ldap_modify($ds, $rdn, $newpass))
{
echo "<p>The entry was modified successfully";
}
else {
echo "<p>The entry couldnt be modified";
}
} //end of bind if condition
} //end of connect if condition
The result from running this code:
connected
Bind successful
The entry couldnt be modified