本文链接http://www.cxybl.com/html/wlbc/Php/20130319/37245.html
- //phpinfo();
- $host = "******:389";
- $user = "**@**";
- $pswd = "*****";
- $ad = ldap_connect($host) or die( "Could not connect!" );
- if($ad){
- //设置参数
- ldap_set_option ( $ad, LDAP_OPT_PROTOCOL_VERSION, 3 );
- ldap_set_option ( $ad, LDAP_OPT_REFERRALS, 0 );
- // bool ldap_bind ( resource $link_identifier [, string $bind_rdn = NULL [, string $bind_password = NULL ]] )
- $bd = ldap_bind($ad, $user, $pswd) or die ("Could not bind");
- echo "ldap_bind success";
- //指定需要获取的用户属性
- $attrs = array("displayname","cn");
- //指定需查询的用户范围
- $filter = "(objectclass=*)";
- //ldap_search ( resource $link_identifier , string $base_dn , string $filter [, array $attributes [, int $attrsonly [, int $sizelimit [, int $timelimit [, int $deref ]]]]] )
- $search = ldap_search($ad, 'DC=**,DC=**,DC=**', $filter, $attrs,0,0,0) or die ("ldap search failed");
- $entries = ldap_get_entries($ad, $search);
- if ($entries["count"] > 0) {
- echo '返回记录数:'.$entries["count"];
- for ($i=0; $i<$entries["count"]; $i++) {
- //所要获取的字段,都必须小写
- if(isset($entries[$i]["displayname"])){
- echo "
displayname: "
.$entries[$i]["displayname"][0]."
";//用户名- if(isset($entries[$i]["cn"][0])){
- echo "cn: ".$entries[$i]["cn"][0]."
";//用户名字- }
- }
- }
- } else {
- echo "
no results found!
";
EasySitePM Enterprise 企业网站管理系统3.5.10.0413 UTF8下载EasySitePM Enterprise3.5系统是一款适用于不同类型企业使用的网站管理平于,它具有多语言、繁简从内核转换、SEO搜索优化、图片自定生成、用户自定界面、可视化订单管理系统、可视化邮件设置、模板管理、数据缓存+图片缓存+文件缓存三重提高访问速度、百万级数据快速读取测试、基于PHP+MYSQL系统开发,功能包括:产品管理、文章管理、订单处理、单页信息、会员管理、留言管理、论坛、模板管
- }
- }else{
- echo "Unable to connect to AD server";
- }
- ?>











