程序名称:在首页显示 ip地址、访问地点、浏览器、操作系统
运行平台: Discuz! 4.1.0
程序作者: Laoniu(修改自4.0首页四格+魔焰男孩的显示访客信息)
修改文件: index.php
修改模板: index.htm
增加文件: userinfo.inc.php,hot_topics.htm
数据升级: 无
增加查询: 2
程序演示:http://www.lnjy.cn/bbs
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、修改index.htm
查找:
- <table cellspacing="{TABLESPACE}" cellpadding="0" border="0" width="{TABLEWIDTH}" align="center" class="outertxt">
- <tr><td class="smalltxt">
- {lang timenow} $currenttime, {lang your_lastvisit} $lastvisittime<br>
- {lang credits}: <span class="bold">$credits</span>
- <!--{loop $extcredits $id $credit}-->
- $credit[title]: <span class="bold">$GLOBALS[extcredits.$id]</span>$credit[unit]
- <!--{/loop}-->
- / {lang index_status}:
- <!--{if $validdays}--><a href="member.php?action=groupexpiry"><span class="bold">$grouptitle</span>($validdays)</a><!--{else}--><span class="bold">$grouptitle</span><!--{/if}-->
- <!--{if !empty($invisible)}--> / {lang login_invisible_mode}<!--{/if}-->
- </td><td align="right" nowrap class="smalltxt">
- <a href="search.php?srchfrom=$newthreads&searchsubmit=yes">{lang show_newthreads}</a> |
- <!--{if $discuz_uid}-->
- <a href="search.php?srchuid=$discuz_uid&mytopics=yes&searchsubmit=yes">{lang show_mytopics}</a> |
- <!--{if $allowuseblog}-->
- <a href="blog.php?uid=$discuz_uid" target="_blank">{lang blog}</a> |
- <!--{/if}-->
- <!--{/if}-->
- <a href="digest.php">{lang digest}</a> |
- <a href="member.php?action=markread">{lang mark_read}</a>
- | {lang welcome_newmember} <a href="viewpro.php?username=$memberenc"><span class="bold">$lastmember</span></a><br>
- {lang total} <span class="bold">$threads</span> {lang index_threads} / <span class="bold">$posts</span> {lang index_posts} / {lang index_today} <span class="bold">$todayposts</span> {lang index_posts} / <span class="bold">$totalmembers</span> {lang index_members}
- </td></tr></table>
复制代码
替换成:
完成安装!
[ 本帖最后由 laoniu 于 2006-4-1 13:00 编辑 ] |