ldap 返回变量
我们对 LDAP 和其他东西还很陌生,到目前为止,我们似乎能做的就是通过 LDAP 身份验证来获取登录名/密码是好还是坏(通过 LDAP bind() 和 php)
我们想要什么要做的是,在登录成功的情况下,从 LDAP 取回一个变量(例如,用户矩阵)。这可能吗?如果可能,如何实现?
LDPA 函数的 PHP 文档示例:
<?php
// using ldap bind
$ldaprdn = 'uname'; // ldap rdn or dn
$ldappass = 'password'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("ldap.example.com")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
We are quite new here with LDAP and stuff and so far, all we seem to be able to do with and LDAP authentification is to get if the login/password is good or bad (Via LDAP bind() with php)
What we would like to do is, in the case of a good login, to get back a variable (for example, the user matricule) from the LDAP. Is this possible, and if it is, how?
Example from the PHP doc of the LDPA function:
<?php
// using ldap bind
$ldaprdn = 'uname'; // ldap rdn or dn
$ldappass = 'password'; // associated password
// connect to ldap server
$ldapconn = ldap_connect("ldap.example.com")
or die("Could not connect to LDAP server.");
if ($ldapconn) {
// binding to ldap server
$ldapbind = ldap_bind($ldapconn, $ldaprdn, $ldappass);
// verify binding
if ($ldapbind) {
echo "LDAP bind successful...";
} else {
echo "LDAP bind failed...";
}
}
?>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
那么在线php手册的ldap_connect示例是错误的:
Then the ldap_connect examples of the online php manual are wrong: