首页四格(访客信息+论坛信息+最新发表+最新回复)for DZ5.0
程序名称: 在首页显示 ip地址、访问地点、浏览器、操作系统
运行平台: Discuz! 5.5.0
程序作者: Laoniu(修改自4.0首页四格+魔焰男孩的显示访客信息 + Bingyen的访客信息)
修改文件: index.php
修改模板: discuz.htm
增加文件: userinfo.inc.php,hot_topics.htm
数据升级: 无
增加查询: 2
程序演示: http://www.imshasha.com
1、上传附件中的两个文件到论坛相应目录;
2、修改index.php
查找:
- require_once './include/common.inc.php';
复制代码
下面加:
- require_once './include/userinfo.inc.php';
复制代码
查找:
- } else {
- $showoldetails = false;
- }
复制代码
下面加:
- //首页热门贴 Start
- $hack_subject_len=34; //每个标题最多显示得字数
- $hack_subject_num=10; //需要显示记录数
- //最新贴
- $query = $db->query("SELECT dateline,tid,subject,author,views,replies FROM {$tablepre}threads ORDER BY dateline DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread[subject0]=$thread[subject];
- $thread['subject'] = cutstr($thread['subject'], $hack_subject_len);
- $hack_newthreads_threadlist[] = $thread;
- }
- $threadview = $threadreply = array();
- //最新回复
- $query = $db->query("SELECT replies, tid, subject,author,views,lastposter FROM {$tablepre}threads where replies !=0 ORDER BY lastpost DESC LIMIT 0, $hack_subject_num");
- while($thread = $db->fetch_array($query)) {
- $thread[subject0]=$thread[subject];
- $thread[subject] = cutstr($thread[subject], $hack_subject_len);
- $threadreply[] = $thread;
- }
- //首页热门贴 End
复制代码
查找:
- $newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
复制代码
下面加:
- $today = mktime (0,0,0,date("m") ,date("d"),date("Y"));
- $build_date = mktime (0,0,0,03,31,2006);//请修改后面的三个数字,分别代表你论坛运行第一天的月,日,年。
- $build_days = (int)(($today-$build_date)/(24*3600));
复制代码
3、修改discuz.htm
找到:
- <!--{if !empty($advlist['text'])}-->
复制代码
在上面添加:
[ 本帖最后由 enbony 于 2007-3-17 22:52 编辑 ] |