Ldap manages connection to LDAP and includes several helper functions.

package | LDAP

### Methods

## Creates a new LDAP object.

    __construct(object $config)

### Parameters

#### $config

`object`

an object of class Config

## Closes connection to LDAP server before serialization

    __sleep()

## Reconnects to LDAP server when deserialized

    __wakeup()

## Closes connection to server

    close()

## Connects to the server using the given username and password

    connect(string $user, string $passwd, boolean $allowAnonymous) : mixed

### Parameters

#### $user

`string`

user name

#### $passwd

`string`

password

#### $allowAnonymous

`boolean`

specifies if anonymous binds are allowed

### Returns

`mixed`if connect succeeds the server handle is returned, else false

## Decrypts a string

    decrypt(object $data, string $prefix) : string

### Parameters

#### $data

`object`

string to decrypt

#### $prefix

`string`

prefix for cookie names

### Returns

`string`decrypted string

## Decrypts username and password

    decrypt_login() : array

### Returns

`array`array(user name, password)

## Closes connection to LDAP server and deletes encrypted username/password

    destroy()

## Encrypts a string

    encrypt(string $data, string $prefix) : object

### Parameters

#### $data

`string`

string to encrypt

#### $prefix

`string`

prefix for cookie names

### Returns

`object`encrypted string

## Encrypts username and password

    encrypt_login(string $username, string $password)

### Parameters

#### $username

`string`

LDAP user name

#### $password

`string`

LDAP password

## Calculates a new value for rand

    new_rand() : int

### Returns

`int`New random value

## Returns the LDAP connection handle

    server() : object

### Returns

`object`connection handle

### Properties

## Object of Config to access preferences

    $conf

## LDAP connection established

    $is_connected

## LDAP password used for bind

    $password

## Random number (changes on every page request)

    $rand

## Server handle

    $server

## LDAP username used for bind

    $username