I believe the manual says that ldap_connect doesn't actually make the connection but rather it just simply sets up the connection parameters. The actual connection doesn't happen until ldap_bind is executed.

 - or so I recall reading some where ;-)



On Jun 19, 2006, at 9:06 AM, Steve Turnbull wrote:

Hi

I have this code (PHP5) as part of a class to do some LDAP stuff...

public function connect()
    {
        $this->ds = @ldap_connect( $this->server, $this->port ); ###
This seems to return true no matter waht????
        if ( $this->ds ) {
            // A successful connection was made
            $this->message .= 'A successful connection was made to the
LDAP server: <b>' . $this->server . "</b><br /><br /> \n";
        } else {
            // The connection was not successful
            $this->message .= 'It was not possible to connect to the
LDAP server: <b>' . $this->server . "</b><br /> \n";
            $this->message .= 'LDAP Error Message: ' .
ldap_error( $this->ds ) . "<br /> \n";
            $this->message .= 'LDAP Error Number: ' .
ldap_errno( $this->ds ) . "<br /> \n";
        }
    }


As you can see, I am expecting a return value of true only if the
ldap_connect makes a successful connection. However, even if I pass
values which should make a false, it gives a true.

What am I missing out on here - could any one tell me why true is always
returned?

Cheers
Steve

--
Steve Turnbull

Digital Content Developer
YHGfL Foundation

e [EMAIL PROTECTED]
t 01724 275030

The YHGfL Foundation Disclaimer can be found at:
http://www.yhgfl.net/foundation-services/yhgfl-email-disclaimer/

--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to