473,394 Members | 1,709 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,394 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 10167
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: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
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...

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.