How to stop a particular error from being logged

Hi there,
I am writing a program that allows users to authenticate using LDAP. The problem I have is if the user enters the wrong username or password PHP treats it as a serious error and logs it in my error log.

[28-Feb-2012 19:23:58] PHP Warning: ldap_bind(): Unable to bind to server: Invalid credentials in C:\inetpub\wwwroot\checklogin.php on line 263

I really dont want to switch off the errorlog so is there any way I can stop this particular error from being logged?

The command I use is

ldapbind=ldap_bind($ldapconn, $username."@".$ldap_domain, $password_ldap);

Many Thanks
Mark

Not sure, but, something like this should work for you…
[php]

<?php // specify the LDAP server to connect to $conn = ldap_connect("www.somewhere.com") or die("Could not connect to server"); // bind to the LDAP server specified above $r = ldap_bind($conn); // if not successful, display error message if(!$r) { echo "An error occurred. Error number " . ldap_errno($conn) . ": " . ldap_err2str(ldap_errno($conn)); } // further processing as required // all done? clean up ldap_close($conn); ?>

[/php]
Good luck!

Sponsor our Newsletter | Privacy Policy | Terms of Service