微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

LDAPAuthPHP PHP的LDAP认证

程序名称:LDAPAuthPHP

授权协议: Apache

操作系统: 跨平台

开发语言: PHP

LDAPAuthPHP 介绍

LDAPAuthPHP 用来在 PHP 程序中执行 LDAP 身份验证。

示例代码

PHP $pageURL = 'http'; if ($_SERVER["HTTPS"] == "on") { $pageURL .= "s"; } $pageURL .= "://"; if ($_SERVER["SERVER_PORT"] != "80") { $pageURL .= $_SERVER["SERVER_NAME"].":".$_SERVER["SERVER_PORT"].$_SERVER["REQUEST_URI"]; } else { $pageURL .= $_SERVER["SERVER_NAME"].$_SERVER["REQUEST_URI"]; }

session_name(‘MYAPP’);
session_start();
if (!isset($_SESSION[“user”])) {
include(“LdapAuth.inc.PHP”);
$ldap=new LdapAuth();
$ldap->setSessionAttr(“user”,”uid”);
$ldap->setSessionName(“MYAPP”);
$ldap->setRedirectPage($pageURL); //page where we get redirected after login
(in this case self)
include(“LdapStandalonePageProtector.inc.PHP”);
}
else {
echo “Logged In As: “.$_SESSION[“user”].”“;
//paste here the old page code (or write the new page to protect)
}

LDAPAuthPHP 官网

http://code.google.com/p/ldap-auth-php/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。

相关推荐