473,396 Members | 2,121 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

ldap_bind warning instead of false

Hi,I wrote a very simple script to perform ldap authentication. Here is
a peace of code:
if ($ldapconn) {
// binding
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);

// verifica bind
if ($ldapbind) {
return true;
} else {
return false;
}
}

The script work quite well and if I insert a correct username and
password it returns me "true". The problem is that if the username or
password are wrong it returns me warning istead of "false".

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in /path/to/my/file.php on line 31

Warning: Cannot modify header information - headers already sent by
(output started at /path/to/my/file.php:31) in /path/to/my/file.php on
line 48

How can I obtain "false"?
ciao
--
Max-B

--------------------------------------------
Recensioni di ristoranti e opinioni libere
http://www.max-b.org
Feb 12 '07 #1
1 10169
Max-B wrote:
Hi,I wrote a very simple script to perform ldap authentication. Here
is a peace of code:
if ($ldapconn) {
// binding
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);

// verifica bind
if ($ldapbind) {
return true;
} else {
return false;
}
}

The script work quite well and if I insert a correct username and
password it returns me "true". The problem is that if the username or
password are wrong it returns me warning istead of "false".

Warning: ldap_bind() [function.ldap-bind]: Unable to bind to server:
Invalid credentials in /path/to/my/file.php on line 31

Warning: Cannot modify header information - headers already sent by
(output started at /path/to/my/file.php:31) in /path/to/my/file.php
on line 48

How can I obtain "false"?
ciao
You can get around this if you supress warning and error messages by
putting a @ in front of the function name:

$ldapbind = @ldap_bind($ldapconn, $ldaprdn, $ldappass);

--
Kim André Akerř
- ki******@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)
Feb 13 '07 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

35
by: jerrygarciuh | last post by:
Hi all, I was just wondering what popular opinion is on PHP giving this warning: Warning: Invalid argument supplied for foreach() in /home/boogerpic/public_html/my.php on line 6 when...
4
by: myName | last post by:
Hi All, Getting warning in lint for this code. Any thought on this? Regards Ajay StcStackInterface::StcStackInterface() : genAlarm( false ), trace( false ),
6
by: kermit | last post by:
I asp.net pages that run on an intranet IIS server. Some op the pages use XLM DOM doc.Load(sPath) to open and parse a XML file. Every time the doc.Load(sPath) executes in IE6 a warning message...
1
by: Jazzkt | last post by:
I have a little issue I hope you can help me with. I retrieve the processes that are running on my computer and get the C4800 warning in certain situations. The code snippet below illustrates my...
5
by: Dmitriy Lapshin [C# / .NET MVP] | last post by:
Hi all, I think the VB .NET compiler should at least issue a warning when a function does not return value. C# and C++ compilers treat this situation as an error and I believe this is the right...
1
by: billa1972 | last post by:
Hi, I am trying to hook into Yellow Freight's rating webservice. Below is the wsdl. When i try and create a proxy file with wsdl.exe i get the following errors, see below. Also, when i...
1
by: downlode | last post by:
Hi, I have a basic script for querying an ldap server. It works fine from my college's production server, but not from another server in the network, though I have been assured access should be...
3
by: eleland | last post by:
I am trying to bind to an LDAP server using php without success. I have a linux server running php compiled with open ldap. I am using the following code taken right from php.net: echo "<h3>LDAP...
5
by: Cubicle Intern | last post by:
Hi, I have a form with multiple fields that confirmed before the form is submitted (ex. email field needs to be completed before the form can be submitted). Once the required fields are...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.