|
-
May 9th, 2008, 08:49 AM
#1
Thread Starter
Hyperactive Member
[RESOLVED] ldap + account validation...
How do I validate accounts using ldap?
If I try to bind the submited data I get this if the user enters a invalid password:
Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials in
Last edited by Zeratulsdomain; Jun 3rd, 2008 at 01:59 PM.
-
May 27th, 2008, 08:00 AM
#2
Thread Starter
Hyperactive Member
Re: ldap + account validation...
anyone?
edit: well I give up, I guess its a PHP bug...
What I ended up doing was reloading the page with php (header) when it detects a bad password then it displays wrong password error on that page... This method works seamlessly (in this case), but it doesnt feel right.
Last edited by Zeratulsdomain; May 27th, 2008 at 10:22 AM.
-
May 27th, 2008, 05:56 PM
#3
Re: ldap + account validation...
If you read the documentation, you will see that the function returns true on success and false on failure. Why not test the result and base your decision of what to do next on the result. Just a thought 
If you do not want the warning to be displayed then you can use the error suppression operator @:
-
Jun 3rd, 2008, 01:58 PM
#4
Thread Starter
Hyperactive Member
Re: ldap + account validation...
thats what I was doing :\
Here is my code, I get that error if I do not have that header.
PHP Code:
$ldapbind = ldap_bind($ldapconn, "$username@X.org", $password);
if ($ldapbind)
{
//this will only EVER be seen if they do not have a samaccountname that matches there credentials
echo "Error, cannot find proper samaccountname...<br />";
}
else
{
echo "Invalid Password...<br />";
$_SESSION['LoginError']=true;
header("Location: " . $_SERVER['PHP_SELF']);
}
but the error suppression operator was something I did not know about...
Last edited by Zeratulsdomain; Jun 3rd, 2008 at 02:02 PM.
-
Jun 3rd, 2008, 04:20 PM
#5
Re: [RESOLVED] ldap + account validation...
It's useful but use it only when you have no other option. Warnings in PHP usual indicate an abnormal condition in most cases this abnormal condition should never have occurred and may produce unpredictable results or errors further along in the script. In a few cases (only a few), the warnings produced are an indication of an abnormal condition but do not can be deal with, withing your code using error handlers.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|