Skip to content

Connecting and Disconnecting

Rich2k edited this page Apr 14, 2013 · 1 revision

constructor($options=array())

When instantiating adLDAP it will automatically make a connection to your Domain Controller using the settings defined within the class itself, see configuring variables

require_once(dirname(__FILE__) . '/adLDAP.php');
$adldap = new adLDAP();

The settings can also be overridden when the class is first called by specifying an array with your options.

Called like $adldap = new adLDAP($options); Where $options is an array with one or more of the following keys

  • string account_suffix

  • string base_dn

  • array domain_controllers

  • string admin_username

  • string admin_password

  • boolean real_primarygroup

  • boolean use_ssl

  • boolean use_tls

  • boolean recursive_groups

  • integer ad_port

  • boolean sso

    require_once(dirname(FILE) . '/adLDAP.php'); $adldap = new adLDAP(array('base_dn'=>'DC=domain,DC=local', 'account_suffix'=>'@domain.local'));

destructor()

adLDAP will NOT automatically disconnect at the end of the script. There is a need to specifically close your connection unless you need to perform a re-connection

connect()

Performs a connection to your domain controller. You should never need to call these functions directly unless you specifically wish to change connection parameters mid-script.

For example

require_once(dirname(__FILE__) . '/adLDAP.php');
$adldap = new adLDAP();
/* Some code here */

$adldap->close();
$adldap->setAdminUsername('Admin.User');
$adldap->setAdminPassword('SomePassword');
$adldap->connect();
/* Some code here */

close()

Disconnect from the domain controller.

Clone this wiki locally