一个漂亮的输出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>
实现效果(遗憾的是邮箱限额未能带出,再确认中):