You are here: Re: ldap_bind warning instead of false « PHP Programming Language « IT news, forums, messages
Re: ldap_bind warning instead of false

Posted by Kim Andrι Akerψ on 02/13/07 02:11

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ΓΈ
- kimandre@NOSPAMbetadome.com
(remove NOSPAM to contact me directly)

 

Navigation:

[Reply to this message]


УдалСнная Ρ€Π°Π±ΠΎΡ‚Π° для программистов  •  Как Π·Π°Ρ€Π°Π±ΠΎΡ‚Π°Ρ‚ΡŒ Π½Π° Google AdSense  •  England, UK  •  ΡΡ‚Π°Ρ‚ΡŒΠΈ Π½Π° английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Π‘Π°ΠΉΡ‚ ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ Π² Π‘Ρ‚ΡƒΠ΄ΠΈΠΈ Π’Π°Π»Π΅Π½Ρ‚ΠΈΠ½Π° ΠŸΠ΅Ρ‚Ρ€ΡƒΡ‡Π΅ΠΊΠ°
ΠΈΠ·Π³ΠΎΡ‚ΠΎΠ²Π»Π΅Π½ΠΈΠ΅ ΠΈ ΠΏΠΎΠ΄Π΄Π΅Ρ€ΠΆΠΊΠ° Π²Π΅Π±-сайтов, Ρ€Π°Π·Ρ€Π°Π±ΠΎΡ‚ΠΊΠ° ΠΏΡ€ΠΎΠ³Ρ€Π°ΠΌΠΌΠ½ΠΎΠ³ΠΎ обСспСчСния, поисковая оптимизация