-
Notifications
You must be signed in to change notification settings - Fork 204
Connecting and Disconnecting
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'));
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
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 */
Disconnect from the domain controller.