Ver Mensaje Individual
  #3 (permalink)  
Antiguo 22/12/2006, 17:49
Avatar de .php
.php
 
Fecha de Ingreso: julio-2006
Mensajes: 481
Antigüedad: 17 años, 9 meses
Puntos: 5
Re: respuesta muy lenta con LDAP

oye. aprovechando esye mismo tema.
yo = tengo hecho algo pequeño que se autentifica con un servidor ldap, handa bien, el problema es cuando ingresan una clave mala me da un error a la funcion. no lo he podido controlar.
te pego mi codigo
Código PHP:
$ldaphost                =    "server.ldap";
$ldapport                =    389;
$_SESSION["username"]        =    $_POST["user"]."@dominio.com";
$_SESSION["upasswd"]        =    $_POST["password"];
$ds                 =    ldap_connect($ldaphost$ldapport) or die("Could not connect to $ldaphost");
if (
$ds){
   
$ldapbind ldap_bind($ds$_SESSION["username"], $_SESSION["upasswd"]);  // line 22
   
ldap_unbind($ds);
   if (
$ldapbind){
            echo 
"<script language='javascript'>window.top.location='./listar.php'</script>";
    }else{    
            echo 
"<script language='javascript'>window.top.location='./index.php'</script>"
    }

cuando el login es incorrecto me lanza un warning
Código:
Warning ldap_bind() [function.ldap-bind]: Unable to bind to server. Invalid credentials in /var/www/portal.php on line 22
__________________
~~[FiDeLio]~~