本文整理汇总了PHP中adLDAP::get_last_error方法的典型用法代码示例。如果您正苦于以下问题:PHP adLDAP::get_last_error方法的具体用法?PHP adLDAP::get_last_error怎么用?PHP adLDAP::get_last_error使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类adLDAP
的用法示例。
在下文中一共展示了adLDAP::get_last_error方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: selectUserFromLdap
function selectUserFromLdap($username, $password)
{
try {
$adldap = new adLDAP();
$adldap->set_account_suffix('@vejleidraetsefterskole.local');
$adldap->set_domain_controllers(array('mail.vih.dk'));
} catch (adLDAPException $e) {
echo $e;
exit;
}
$authUser = $adldap->authenticate($username, $password);
if ($authUser === true) {
return new k_AuthenticatedUser($username);
} else {
throw new Exception('User authentication unsuccessful. ' . $adldap->get_last_error());
}
}
示例2: NestedTree
$ldap_connection = false;
//Build tree of folders
$tree = new NestedTree($pre . 'nested_tree', 'id', 'parent_id', 'title');
/* LDAP connection */
if ($debug_ldap == 1) {
$dbg_ldap = fopen("../files/ldap.debug.txt", "w");
//create temp file
}
if (isset($_SESSION['settings']['ldap_mode']) && $_SESSION['settings']['ldap_mode'] == 1 && $username != "admin") {
if ($debug_ldap == 1) {
fputs($dbg_ldap, "Get all ldap params : \n" . 'base_dn : ' . $_SESSION['settings']['ldap_domain_dn'] . "\n" . 'account_suffix : ' . $_SESSION['settings']['ldap_suffix'] . "\n" . 'domain_controllers : ' . $_SESSION['settings']['ldap_domain_controler'] . "\n" . 'use_ssl : ' . $_SESSION['settings']['ldap_ssl'] . "\n" . 'use_tls : ' . $_SESSION['settings']['ldap_tls'] . "\n*********\n\n");
}
require_once "../includes/libraries/adLDAP/adLDAP.php";
$adldap = new adLDAP(array('base_dn' => $_SESSION['settings']['ldap_domain_dn'], 'account_suffix' => $_SESSION['settings']['ldap_suffix'], 'domain_controllers' => array($_SESSION['settings']['ldap_domain_controler']), 'use_ssl' => $_SESSION['settings']['ldap_ssl'], 'use_tls' => $_SESSION['settings']['ldap_tls']));
if ($debug_ldap == 1) {
fputs($dbg_ldap, "Create new adldap object : " . $adldap->get_last_error() . "\n\n\n");
//Debug
}
//authenticate the user
if ($adldap->authenticate($username, $password_clear)) {
$ldap_connection = true;
} else {
$ldap_connection = false;
}
if ($debug_ldap == 1) {
fputs($dbg_ldap, "After authenticate : " . $adldap->get_last_error() . "\n\n\n" . "ldap status : " . $ldap_connection . "\n\n\n");
//Debug
}
}
//Check if user exists in cpassman
$sql = "SELECT * FROM " . $pre . "users WHERE login = '" . $username . "'";