Need help LDAP Bind show warning message
Posted: Thu Mar 31, 2016 10:45 am
Hi everyone.
Today, we found some issue with ldap_bind when the user input the wrong password showing the message below.
[text]Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in C:\xampp\htdocs\auth.php on line 60[/text]
but when user input the right password not found any issue.
please advise me to fix the issue, I need to hide the warning message and show other message.
I am a newbie with PHP language.
Today, we found some issue with ldap_bind when the user input the wrong password showing the message below.
[text]Warning: ldap_bind(): Unable to bind to server: Can't contact LDAP server in C:\xampp\htdocs\auth.php on line 60[/text]
but when user input the right password not found any issue.
please advise me to fix the issue, I need to hide the warning message and show other message.
I am a newbie with PHP language.
Code: Select all
$username = $_POST['username'];
$password = $_POST['password'];
function ldap_authenticate($ldapserver, $domain, $username, $password) {
if ($username != "" && $password != "") {
putenv('LDAPTLS_REQCERT=never');
$ds = @ldap_connect($ldapserver) or die('Could not connect to LDAP server.');
$lb = ldap_bind($ds,$username.'@'.$domain,$password);
if($lb) {
return 1;
} else {
return NULL;
}
}
return NULL;
}