用PHP输出LDAP查询结果
2014-03-31 18:01
281 查看
做好Postfix+LDAP后,一直想写个程式,自动抓取LDAP中的邮箱地址,不用手动更改全局邮箱地址再发布,今天终于如愿,主要参考如下网页,在些感谢:
一个漂亮的输出MySql数据库表结构的PHP页面
http://babyhe.blog.51cto.com/1104064/1118372
使用PHP连接LDAP服务器 http://www.justwinit.cn/post/591/
我的PHP源码:
点击(此处)折叠或打开
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body,table{
font-size:13px;
}
table{
table-layout:fixed;
empty-cells:show;
border-collapse: collapse;
margin:0 auto;
border:1px solid #cad9ea;
}
th{
height:22px;
font-size:13px;
font-weight:bold;
background-color:#CCCCCC;
text-align:center;
}
td{
height:20px;
}
.tableTitle{font-size:14px; font-weight:bold;}
.STYLE1 {color: #FF0000}
</style>
<title>Email Address</title>
</head>
<body>
<div style="margin:0 auto;width:800px; border:1px #006600 solid; font-size:12px; line-height:20px;">
<div style="width:100%;height:30px; font-size:16px; font-weight:bold; text-align:center;">
XXXX--郵箱清單<br />
<font style="font-size:14px; font-weight:normal;"><b><span class="STYLE1">更新時間</span>:</b><?php echo date("Y-m-d h:i:s"); ?></font> </div>
<?php
$connect_id=ldap_connect("x.x.x.x");
$result_array=array("cn","mail","mailQuota");
$search_id=ldap_search($connect_id,"virtualDomain=x.com,o=extmailAccount,dc=x.com", "cn=*",$result_array);
$result_array = ldap_get_entries($connect_id,$search_id);
for($i=0;$i<$result_array["count"];$i++)
{
$format_array[$i][0]=strtolower($result_array[$i]["cn"][0]);
$format_array[$i][1]=strtolower($result_array[$i]["mail"][0]);
$format_array[$i][2]=strtolower($result_array[$i]["mailQuota"][0]);
}
sort($format_array);
/* for($row=0;$row<$result_array["count"];$row++)
{
//print_r($row); */
?>
<div style="margin:0 auto; width:100%; padding-top:10px;">
<br/>
</div>
<table width="100%" border="1">
<thead>
<th width="10">ROW</th>
<th width="50">姓名</td>
<th width="100">郵箱地址</td>
<th width="100">郵箱限額</td>
</thead>
<?php
// for($i=0;$i<=$row$result_array["count"];$i++)
for($i=0;$i<=$result_array["count"];$i++)
{
$cn=$format_array[$i][0];
$mail=$format_array[$i][1];
$quota=$format_array[$i][2];
?>
<tr>
<td align="center"><?php echo $i ?></td>
<td align="left"><b><?php echo $cn ?></b></td>
<td align="left"><?php echo $mail ?></td>
<td align="left"><?php echo $quota ?></td>
</tr>
<?php
}
?>
</table>
<?php
//}
ldap_close($connect_id);
?>
</div>
</body>
</html>
实现效果(遗憾的是邮箱限额未能带出,再确认中):
阅读(9) | 评论(0) | 转发(0) |
0
上一篇:一个漂亮的输出MySql数据库表结构的PHP页面
下一篇:网页自动跳转的5中方法
相关热门文章
天津二手房市近日开始降温 买...
河南省消协提醒买卖二手房警惕...
UBOOT-2012-10在OK6410平台的...
华美远航(北京)投资有限公司...
Accept-Encoding: gzip,deflat...
test123
编写安全代码——小心有符号数...
使用openssl api进行加密解密...
一段自己打印自己的c程序...
sql relay的c++接口
IBM DS3400 盘阵怎么查看是单...
启动auditd时,报错如下,怎么...
CGSL系统中root密码正确,但无...
在CGSL系统中,如何为不同的用...
CGSL系统如何设置交换分区的大...
给主人留下些什么吧!~~
评论热议
一个漂亮的输出MySql数据库表结构的PHP页面
http://babyhe.blog.51cto.com/1104064/1118372
使用PHP连接LDAP服务器 http://www.justwinit.cn/post/591/
我的PHP源码:
点击(此处)折叠或打开
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<style type="text/css">
<!--
body,table{
font-size:13px;
}
table{
table-layout:fixed;
empty-cells:show;
border-collapse: collapse;
margin:0 auto;
border:1px solid #cad9ea;
}
th{
height:22px;
font-size:13px;
font-weight:bold;
background-color:#CCCCCC;
text-align:center;
}
td{
height:20px;
}
.tableTitle{font-size:14px; font-weight:bold;}
.STYLE1 {color: #FF0000}
</style>
<title>Email Address</title>
</head>
<body>
<div style="margin:0 auto;width:800px; border:1px #006600 solid; font-size:12px; line-height:20px;">
<div style="width:100%;height:30px; font-size:16px; font-weight:bold; text-align:center;">
XXXX--郵箱清單<br />
<font style="font-size:14px; font-weight:normal;"><b><span class="STYLE1">更新時間</span>:</b><?php echo date("Y-m-d h:i:s"); ?></font> </div>
<?php
$connect_id=ldap_connect("x.x.x.x");
$result_array=array("cn","mail","mailQuota");
$search_id=ldap_search($connect_id,"virtualDomain=x.com,o=extmailAccount,dc=x.com", "cn=*",$result_array);
$result_array = ldap_get_entries($connect_id,$search_id);
for($i=0;$i<$result_array["count"];$i++)
{
$format_array[$i][0]=strtolower($result_array[$i]["cn"][0]);
$format_array[$i][1]=strtolower($result_array[$i]["mail"][0]);
$format_array[$i][2]=strtolower($result_array[$i]["mailQuota"][0]);
}
sort($format_array);
/* for($row=0;$row<$result_array["count"];$row++)
{
//print_r($row); */
?>
<div style="margin:0 auto; width:100%; padding-top:10px;">
<br/>
</div>
<table width="100%" border="1">
<thead>
<th width="10">ROW</th>
<th width="50">姓名</td>
<th width="100">郵箱地址</td>
<th width="100">郵箱限額</td>
</thead>
<?php
// for($i=0;$i<=$row$result_array["count"];$i++)
for($i=0;$i<=$result_array["count"];$i++)
{
$cn=$format_array[$i][0];
$mail=$format_array[$i][1];
$quota=$format_array[$i][2];
?>
<tr>
<td align="center"><?php echo $i ?></td>
<td align="left"><b><?php echo $cn ?></b></td>
<td align="left"><?php echo $mail ?></td>
<td align="left"><?php echo $quota ?></td>
</tr>
<?php
}
?>
</table>
<?php
//}
ldap_close($connect_id);
?>
</div>
</body>
</html>
实现效果(遗憾的是邮箱限额未能带出,再确认中):
阅读(9) | 评论(0) | 转发(0) |
0
上一篇:一个漂亮的输出MySql数据库表结构的PHP页面
下一篇:网页自动跳转的5中方法
相关热门文章
天津二手房市近日开始降温 买...
河南省消协提醒买卖二手房警惕...
UBOOT-2012-10在OK6410平台的...
华美远航(北京)投资有限公司...
Accept-Encoding: gzip,deflat...
test123
编写安全代码——小心有符号数...
使用openssl api进行加密解密...
一段自己打印自己的c程序...
sql relay的c++接口
IBM DS3400 盘阵怎么查看是单...
启动auditd时,报错如下,怎么...
CGSL系统中root密码正确,但无...
在CGSL系统中,如何为不同的用...
CGSL系统如何设置交换分区的大...
给主人留下些什么吧!~~
评论热议
相关文章推荐
- PHP中把数据库查询结果输出为json格式简单实例
- PHP 实现查询结果动态组合输出
- MySql数据库查询结果用表格输出PHP代码示例
- php输出mysqli查询出来的结果
- PHP查询MySql数据库,将结果用表格输出实例
- MySql数据库查询结果用表格输出PHP代码示例
- php输出mysqli查询出来的结果
- php输出mysqli查询出来的结果
- PHP中PDO对像及PDOStatement::fetch()的用法数据库查询,结果输出处理
- PHP中的&传值引用的问题,在foreach循环的结果能帮解释下输出的结果原理是什么?
- php数据库操作——获取数据查询结果
- mysql查询结果输出到文件
- PHP使用PDO抽象层获取查询结果的方法示例
- 使PHP即时输出结果到浏览器
- pymssql中查询结果输出,输出内容的误解
- PHP开发中四种查询返回结果分析
- php中查询结果展示
- MySQL – 查询按IN的顺序输出结果
- 专业语言:Java数据库查询结果的输出
- Web Mapping for Silverlight:拉框查询,并将结果输出到表格中