public function bind($username, $password)
    {
        // Tries to run the LDAP Connection as TLS
        if ($this->tls) {
            if ( ! ldap_start_tls($this->connection)) {
                throw new ConnectionException('Unable to Connect to LDAP using TLS.');
            }
        }

        try {
            $this->bound = ldap_bind($this->connection, $username, $password);
        } catch (ErrorException $e) {
            $this->bound = false;
        }

        return $this->bound;
    }
public function bind($username, $password)
    {
        // Tries to run the LDAP Connection as TLS
        if ($this->tls) {
            if ( ! ldap_start_tls($this->connection)) {
                throw new ConnectionException('Unable to Connect to LDAP using TLS.');
            }
        }

        try {
            $this->bound = ldap_bind($this->connection, $username, $password);
        } catch (ErrorException $e) {
            $this->bound = false;
        }

        return $this->bound;
    }
public function bind ( $ username , $ password ) { // Tries to run the LDAP Connection as TLS if ( $ this -> tls ) { if ( ! ldap_start_tls ( $ this -> connection ) ) { throw new ConnectionException ( 'Unable to Connect to LDAP using TLS.' ) ; } } try { $ this -> bound = ldap_bind ( $ this -> connection , $ username , $ password ) ; } catch ( ErrorException $ e ) { $ this -> bound = false ; } return $ this -> bound ; }
Binds LDAP connection to the server

@param $username
@param $password

@return bool

@throws ConnectionException
Binds LDAP connection to the server