Discuz论坛发帖统计

工作需要 老板一句话 要统计发帖数目 小竹子我 开始搬砖

历史久远了 仿佛是 discuz6.0版本

输出 execl 格式【execl 2003】

需要 pdo 扩展

 1 <?php
 2 $date=31;//论坛7月1-'.$date.'号发帖统计
 3 header('Cache-Control: no-cache, must-revalidate');
 4 header('Content-type: application/vnd.ms-excel');
 5 header('Content-Disposition: filename=论坛7月1-'.$date.'号发帖统计(包括回复的帖子数目).xls');
 6 ?>
 7 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
 8 <html xmlns="http://www.w3.org/1999/xhtml">
 9 <head>
10 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
11 <title>包括回复的帖子数目</title>
12 </head>
13 <body>
14 <?php 
15 $users = array(
16                 "员工1"=>"'sbest'",
17          "员工2"=>"'水水','丨写往事'",
18          "员工3"=>"'jackal2112'",
19          "员工4"=>"'jordan0823'"
20         );
21 ?>
22 <table width="100%" border="1" cellspacing="1" cellpadding="1">
23   <tr align="center">
24     <td nowrap><b>日期</b></td>
25     <?php
26     foreach($users as $user=>$u_sql){
27       echo "<td nowrap><b>".$user."</b></td>";
28     }    
29     ?>
30   </tr>
31   <?php
32     $j=1;
33     for($i=1;$i<=$date;$i++){
34       echo "<tr align=\"center\"><td nowrap>2011-7-".$j++."</td>";
35       foreach($users as $user=>$u_sql){
36         $pdo = new PDO("mysql:host=localhost;dbname=forum_xxx_com;port=3306","root","mima",array(PDO::MYSQL_ATTR_INIT_COMMAND => "SET NAMES utf8"));
37         $start = "2011-7-".$i;
38         if($i==$date){
39           $end = "2011-8-1";
40         }else{
41           $end = "2011-7-".($i+1);
42         }
43         $start = strtotime($start);
44         $end = strtotime($end);
45         $fuck = $pdo->query("SELECT tid FROM forum_posts where author in ({$u_sql}) and dateline BETWEEN {$start} and {$end}");
46         $rowCount = 0;
47         $rowCount = $fuck->rowCount();
48         echo "<td nowrap>".$rowCount."</td>";
49       }
50       echo "</tr>";
51     }    
52     ?>
53 </table>
54 </body>
55 </html>

 

 

转载于:https://www.cnblogs.com/zhusanjie/p/3659868.html

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值