本文整理汇总了PHP中Ldap::lda_connect方法的典型用法代码示例。如果您正苦于以下问题:PHP Ldap::lda_connect方法的具体用法?PHP Ldap::lda_connect怎么用?PHP Ldap::lda_connect使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Ldap
的用法示例。
在下文中一共展示了Ldap::lda_connect方法的3个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getsambagroups
function getsambagroups($type)
{
global $conf;
// Si la liste des groupes est defini dans la config on l'utilise
if ($type == "unix" && isset($conf['samba']['unixgroups'])) {
return $conf['samba']['unixgroups'];
}
if ($type == "smb" && isset($conf['samba']['smbgroups'])) {
return $conf['samba']['smbgroups'];
}
// sinon on interroge LDAP
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
$filter = "(objectClass=sambaGroupMapping)";
$rdn = LDAP_BASE;
$sr = ldap_search($ldapconn, $rdn, $filter);
$info = ldap_get_entries($ldapconn, $sr);
ldap_unbind($ldapconn);
$ret = array();
for ($i = 0; $i < $info['count']; $i++) {
$entry = $info[$i];
$cn = $entry['cn'][0];
if ($type == "unix") {
$ret[$cn] = $entry['gidnumber'][0];
} elseif ($type == "smb") {
$tmp = explode('-', $entry['sambasid'][0]);
$ret[$cn] = "-" . array_pop($tmp);
}
}
return $ret;
}
示例2: is_what
function is_what($login, $what)
{
$ldapconnisuid = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
$filter = "(" . $what . "=" . $login . ")";
$sr = ldap_search($ldapconnisuid, LDAP_BASE, $filter);
$info = ldap_get_entries($ldapconnisuid, $sr);
if ($info['count']) {
ldap_unbind($ldapconnisuid);
return $info['count'];
} else {
ldap_unbind($ldapconnisuid);
return FALSE;
}
}
示例3: session_start
session_start();
if (isset($_SESSION['login'])) {
display("Déconnexion");
}
session_unset('EVOADMIN_SESS');
session_destroy();
session_name('EVOADMIN_SESS');
session_start();
/**
* Case with $_POST data
* We try to verify login/password
* and we forward to superadmin.php
*/
if (isset($_POST['login'])) {
// connexion pour rechercher uid
$ldapconn = Ldap::lda_connect(LDAP_ADMIN_DN, LDAP_ADMIN_PASS);
if ($ldapconn) {
$login = Html::clean($_POST['login']);
$filter = "(&(uid=" . $login . ")(isAdmin=TRUE))";
$sr = ldap_search($ldapconn, LDAP_BASE, $filter);
$info = ldap_get_entries($ldapconn, $sr);
if ($info['count']) {
$bind = @ldap_bind($ldapconn, $info[0]['dn'], $_POST['password']);
if ($bind) {
$_SESSION['login'] = $login;
$_SESSION['dn'] = $info[0]['dn'];
EvoLog::log("Login success for " . $login);
header("location: superadmin.php\n\n");
exit(0);
} else {
badauth();