本文整理汇总了PHP中Ldap::getLdapUserAttribute方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::getLdapUserAttribute方法的具体用法?PHP Ldap::getLdapUserAttribute怎么用?PHP Ldap::getLdapUserAttribute使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ldap
的用法示例。
在下文中一共展示了Ldap::getLdapUserAttribute方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: isset
$ldap_username = isset($_POST['ldapUser']) && trim($_POST['ldapUser']) != '' ? $_POST['ldapUser'] : null;
$auth = new Ldap();
$auth->setLdapAccountBase($ldap_account_base);
$auth->setLdapAccountEmail($ldap_account_email);
$auth->setLdapAccountFullname($ldap_account_full_name);
$auth->setLdapBindType($ldap_bind_type);
$auth->setLdapBindScope($ldap_bind_scope);
$auth->setLdapPassword($ldap_password);
$auth->setLdapUsername($ldap_username);
$auth->setLdapPort($ldap_port);
$auth->setLdapServer($ldap_server);
$auth->setLdapSslVerify($ldap_ssl_verify);
$auth->setLdapStartTls($ldap_start_tls);
$auth->setLdapUserPattern($ldap_user_pattern);
try {
$username = $auth->getLdapUserAttribute();
$info = $auth->listAllUsers(array($auth->getLdapUserAttribute(), $ldap_account_full_name, $ldap_account_email), 0);
if (is_array($info)) {
for ($i = 0; $i < $info['count']; $i++) {
$user = @$info[$i][$username][0];
echo '<tr>';
echo '<td><input type="checkbox" name="ldapAdminUser[]" value="' . $user . '" /></td>';
echo '<td>' . $user . '</td>';
echo '<td>' . @$info[$i][$ldap_account_full_name][0] . '</td>';
echo '<td>' . @$info[$i][$ldap_account_email][0] . '</td>';
echo '</tr>';
}
}
} catch (Exception $e) {
error_log($e->getMessage());
echo '<tr>';
示例2: listUsers
/**
* List all users for moderators
*
*/
function listUsers()
{
$toReturn = "";
$db = new RecordSet($this->dbConnectionInfo);
// To protect MySQL injection
$query = "SELECT * FROM users";
$db->Open($query);
$toReturn .= "<table id=\"usersList\" cellpadding='0' cellspacing='0'>";
$toReturn .= "<thead>";
$toReturn .= "<tr>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.userName.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.name.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.level.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.company.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.email.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.date.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.notifyAll.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.notifyReply.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.notifyPage.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.status.label');
$toReturn .= "</td>";
$toReturn .= "<td>";
$toReturn .= Utils::translate('admin.user.type');
$toReturn .= "</td>";
$toReturn .= "</tr>";
$toReturn .= "</thead>";
while ($db->MoveNext()) {
$user['id'] = $id = $db->Field('userId');
$user['userName'] = $db->Field('userName');
$user['name'] = $db->Field('name');
$user['level'] = $db->Field('level');
$user['company'] = $db->Field('company');
$user['email'] = $db->Field('email');
$user['company'] = $db->Field('company');
$user['date'] = $db->Field('date');
$user['notifyAll'] = $db->Field('notifyAll');
$user['notifyReply'] = $db->Field('notifyReply');
$user['notifyPage'] = $db->Field('notifyPage');
$user['status'] = $db->Field('status');
$user['ldapUser'] = $this->isLdapUser($db->Field('userName')) ? 'LDAP User' : 'Local User';
$users[] = $user;
$userNames[] = $user['userName'];
}
if ($this->ldap instanceof Ldap) {
$ldapUsers = array();
try {
$uAttribute = $this->ldap->getLdapUserAttribute();
$ldapUsers = $this->ldap->listAllUsers(array($uAttribute, LDAP_ACCOUNT_EMAIL, LDAP_ACCOUNT_FULLNAME), 0);
} catch (Exception $e) {
error_log($e->getMessage());
}
$i = 0;
foreach ($ldapUsers as $key => $user) {
$i++;
if ((string) $key != 'count') {
$un = $user[$uAttribute][0];
if (!in_array($un, $userNames)) {
$uName['id'] = 'ldap_' . $un;
$uName['userName'] = $un;
@($uName['name'] = $user[LDAP_ACCOUNT_FULLNAME][0]);
$uName['level'] = 'user';
$uName['company'] = '';
@($uName['email'] = $user[LDAP_ACCOUNT_EMAIL][0]);
$uName['date'] = '';
$uName['notifyAll'] = 'no';
$uName['notifyReply'] = 'no';
$uName['notifyPage'] = 'no';
$uName['status'] = 'validated';
$uName['ldapUser'] = 'LDAP User';
$users[] = $uName;
$userNames[] = $un;
}
}
}
}
foreach ($users as $user) {
if ($user['userName'] != "anonymous" && $user['id'] != 1) {
//.........这里部分代码省略.........
示例3: Ldap
echo "<br/>Could not bind LDAP server using specified information:";
echo "<table class=\"info\">";
echo "<tr><td>Host </td><td>" . LDAP_SERVER . "</td></tr>";
echo "<tr><td>Port </td><td>" . LDAP_PORT . "</td></tr>";
echo "<tr><td>Bind Type </td><td>" . LDAP_BIND_TYPE . "</td></tr>";
if (LDAP_BIND_TYPE != "anonymous") {
echo "<tr><td>Username </td><td>" . LDAP_USERNAME . "</td></tr>";
echo "<tr><td>Password </td><td>" . "*****" . "</td></tr>";
}
echo "</table>";
$continue = false;
} else {
// check LDAP lookup
try {
$ldap = new Ldap();
$uAttribute = $ldap->getLdapUserAttribute();
$ldapUsers = $ldap->listAllUsers(array($uAttribute, LDAP_ACCOUNT_EMAIL, LDAP_ACCOUNT_FULLNAME), 0);
if (!(is_array($ldapUsers) && $ldapUsers['count'] > 0)) {
echo "<br/>Could not find LDAP users using specified information:";
echo "<table class=\"info\">";
echo "<tr><td>Host </td><td>" . LDAP_SERVER . "</td></tr>";
echo "<tr><td>Port </td><td>" . LDAP_PORT . "</td></tr>";
echo "<tr><td>Bind Type </td><td>" . LDAP_BIND_TYPE . "</td></tr>";
if (LDAP_BIND_TYPE != "anonymous") {
echo "<tr><td>Username </td><td>" . LDAP_USERNAME . "</td></tr>";
echo "<tr><td>Password </td><td>" . "*****" . "</td></tr>";
}
echo "<tr><td>Account Base </td><td>" . LDAP_ACCOUNT_BASE . "</td></tr>";
echo "<tr><td>User Pattern </td><td>" . LDAP_USER_PATTERN . "</td></tr>";
echo "</table>";
$continue = false;