Reputation: 315
I am authenticating with ldap and have it all working when the correct credentials are put in however if the user is not valid or the password is incorrect the ldap_bind gives the following warning:
Warning: ldap_bind(): Unable to bind to server: Invalid credentials...
This means the following line which i think should check if the ldap_bind has worked is being executed when it should fail:
$ldapbind = ldap_bind($ldapconn,"uid=$username,cn=users,dc=abc,dc=net", "$password");
if ($ldapbind) {
Do i need to change the if statment so the warning for invalid credentials results in a fail and it moves onto the else statment ? I have tried the following but it hasn't made a difference.
if (($ds) !== false )
Upvotes: 2
Views: 291
Reputation: 4402
You can try:
$ldapbind = @ldap_bind($ldapconn,"uid=$username,cn=users,dc=abc,dc=net", "$password");
if ($ldapbind) {
Upvotes: 2