This topic is locked
[SOLVED]

 Warnings displayed...

8/23/2010 8:28:48 AM
PHPRunner General questions
C
CarLN author

Hi, How are you??? <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15051&image=1&table=forumtopics' class='bbc_emoticon' alt=':)' />

English isn't my native language, so sorry for some mistakes <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15051&image=2&table=forumtopics' class='bbc_emoticon' alt=':D' />
I have used PHPRunner and loved it. It saves my work and my time!

I have tried to implement a LDAP Authentication from my Zimbra. The code below works fine...
function ValidarUsuario_FOB($strUsuario, $strSenha)

{

$ldap['user'] = $strUsuario;

$ldap['pass'] = $strSenha;

$ldap['host'] = 'xxx.xxx.xx.xx';

$ldap['port'] = 389;

$ldap['dn'] = 'uid='.$ldap['user'].',ou=people,dc=xx,dc=xx,dc=xx';

$ldap['base'] = '';

// Conectando ao LDAP

$ldap['conn'] = ldap_connect( $ldap['host'], $ldap['port'] );

ldap_set_option($ldap['conn'], LDAP_OPT_PROTOCOL_VERSION, 3);
//Tenta marcar a conexão... o @ é para evitar a mensdem de advertência

@$ldap['bind'] = ldap_bind( $ldap['conn'], $ldap['dn'], $ldap['pass'] );
if ($ldap['bind']) return true;

else return false;

}
//Example of usage

if (ValidarUsuario_FOB("you", "password")) echo "Authenticated!";
Well... What is it the problem? Seems nothing hehe! But when it executes the line @$ldap['bind'] = ldap_bind( $ldap['conn'], $ldap['dn'], $ldap['pass'] );, which I put @ at begin of the line for doesn't show warning, the warnings appear <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15051&image=3&table=forumtopics' class='bbc_emoticon' alt=':(' /> !!!
As you see, my native language is Portuguese-BR, so the display warning is in portuguese-br.
php Ocorreu o erro...

Informações Técnicas

Tipo de Erro 2

Descrição do Erro ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials

URL xz.xx.xx.xx/ip/login.php?

Arquivo de Erro E:\xampplite\htdocs\ip\login.php

Linha com Erro 15

Consulta de SQL select * from usuario where nome='username' and senha='password'
More info
Call stack

File: line Function Arguments

0. login.php:15 ldap_bind 1. Resource id #22;

  1. uid=username,ou=people,dc=xx,dc=xxx,dc=xxx;
  2. casa123;

    1. login.php:15 ValidarUsuario_FOB 1. username;


  3. password;

    2. login.php:145 Global scope N/A



    See another thing: it isn't a error! It is a warning.
    How do I deactivate it?

    I have tried set the variables "display_errors" and "display_startup_errors", function error_reporting, etc... and nothiiiiiinggg... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15051&image=4&table=forumtopics' class='bbc_emoticon' alt=':(' /> ! I can't remove the warning message! Well... so... then... What do I do???
    Thanks a lot <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=question&id=15051&image=5&table=forumtopics' class='bbc_emoticon' alt=':)' />

    CarLN



A
ann 8/24/2010

CarlN,
there are many ways to disable error reporting in PHP.

For example you can call error_reporting() function at the beginning of the code:

error_reporting(0);



You can find an additional info on this topic in PHP documenttation.

Sergey Kornilov admin 8/24/2010

To the best of my knowledge the following is an error:
Descrição do Erro ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials
Make sure username/password that you use to connect to LDAP server are correct.

C
CarLN author 8/24/2010

Hi people <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=52115&image=1&table=forumreplies' class='bbc_emoticon' alt=':)' />



CarlN,
there are many ways to disable error reporting in PHP.

For example you can call error_reporting() function at the beginning of the code:

error_reporting(0);



You can find an additional info on this topic in PHP documenttation.



I tried it, but it didn't work <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=52115&image=2&table=forumreplies' class='bbc_emoticon' alt=':(' /> . As I said, I tried several ways <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=52115&image=3&table=forumreplies' class='bbc_emoticon' alt=':(' />... I think can be the source of PHPRunner...

I also tried to put at the beginning of the code and got failed. At the middle too... and before my function.



To the best of my knowledge the following is an error:
Descrição do Erro ldap_bind() [function.ldap-bind]: Unable to bind to server: Invalid credentials
Make sure username/password that you use to connect to LDAP server are correct.



But the intention is precisely this. If the user or password is invalid, it returns false.
I made a clean code and worked without showing the error and breaking the app hehe... see below please <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=52115&image=4&table=forumreplies' class='bbc_emoticon' alt=':)' />
<?php

function ValidarUsuario_FOB($strUsuario, $strSenha)

{

$ldap['user'] = $strUsuario;

$ldap['pass'] = $strSenha;

$ldap['host'] = 'xxx.xx.xx.xx';

$ldap['port'] = 389;

$ldap['dn'] = 'uid='.$ldap['user'].',ou=people,dc=fob,dc=usp,dc=br';

$ldap['base'] = '';

// Conectando ao LDAP

$ldap['conn'] = ldap_connect( $ldap['host'], $ldap['port'] );

ldap_set_option($ldap['conn'], LDAP_OPT_PROTOCOL_VERSION, 3);
//Tenta marcar a conexão... o @ é para evitar a mensdem de advertência

if (@ldap_bind( $ldap['conn'], $ldap['dn'], $ldap['pass'])) return true;

else return false;

}
if (ValidarUsuario_FOB("kaka", "teste")) echo "Authenticated!!!";

else

{

echo "Not authenticated!!!";

exit(0);

}
@ini_set("display_errors","1");

@ini_set("display_startup_errors","1");
include("include/dbcommon.php");
add_nocache_headers();
.

.

.

.
When I execute it, it shows "Not authenticated!!" without showing an error or a warning...!

Remember I put this in file called Login.php...
Thanks... <img src='https://asprunner.com/forums/file.php?topicimage=1&fieldname=reply&id=52115&image=5&table=forumreplies' class='bbc_emoticon' alt=':D' />

A
ann 8/26/2010

CarLN,
try to make these changes in the generated login.php file directly.
If it doesn't help please publish your project on Demo Account and open a ticket at http://support.xlinesoft.com sending a URL to your pages along with instructions on reproducing this error. 'Demo Account' button can be found on the last screen in the program.