adLDAP - LDAP authentication with PHP for Active Directory

SourceForge.net Logo

Error Messages

When using adLDAP functions, many of the PHP fatal errors are supressed to allow continued execution of scripts and the return of false responses from a function.

getLastError()

This function allows you to return the last error message that Active Directory encountered.

$disableAccount = $adldap->user()->disable('AD.UserName');
 
if ($disableAccount === false) {
    echo $adldap->getLastError();
}

Exception Handling

For bind/connection errors or where SSL is required and not configured e.g. modifying passwords then adLDAP will throw an adLDAPException.

These can be handled as follows

try {
    $adldap = new adLDAP();
}
catch (adLDAPException $e) {
    echo $e; exit();
}

or

try {
    $modifyPassword = $adldap->user()->password($username, $newpassword);
    /* ... Other Code here ... */
}
catch (adLDAPException $e) {
    echo $e; exit();
}
 
documentation_error_handling.txt · Last modified: 2010/11/18 15:47 by rich2000
 
Recent changes RSS feed Creative Commons License Donate Powered by PHP Valid XHTML 1.0 Valid CSS Driven by DokuWiki