原作者:cnteacher
修改:muhan
4.0修改:咕咕
1.升级数据库
- ALTER TABLE `cdb_members` ADD `logintime` INT(10) DEFAULT '0' NOT NULL,ADD `periodoftime` INT(10) DEFAULT '0' NOT NULL;
复制代码
2.修改include/db_mysql.class.php
查找
- function query($sql, $type = '') {
- $mtime = explode(' ', microtime());
- $discuz_starttime = $mtime[1] + $mtime[0];
- $func = $type == 'UNBUFFERED' && @function_exists('mysql_unbuffered_query') ?
- 'mysql_unbuffered_query' : 'mysql_query';
- if(!($query = $func($sql)) && $type != 'SILENT') {
- $this->halt('MySQL Query Error', $sql);
- }
- $this->querynum++;
- $mtime = explode(' ', microtime());
- $this->info .= "<hr>".substr(($mtime[1] + $mtime[0]-$discuz_starttime),0,7).": $sql [$type]";
-
- return $query;
- }
复制代码
下面添加
- function unbuffered_query($sql, $silence = 0) {
- $func_unbuffered_query = @function_exists('mysql_unbuffered_query') ? 'mysql_unbuffered_query' : 'mysql_query';
- $query = $func_unbuffered_query($sql);
- if(!$query && !$silence) {
- $this->halt('MySQL Query Error', $sql);
- }
- $this->querynum++;
- return $query;
- }
复制代码
3.修改include/common.inc.php
找到
前面添加
- m.logintime, m.periodoftime,
复制代码
找到
上面添加
- //今日到访 by cnteacher 分时段详细列表 by DyNE
- list($thisyear,$thismonth,$thisday,$thishour) = explode(':',gmdate('Y:m:d:H',$timestamp + $timeoffset * 3600));
- $todaylogincheck =gmmktime(0,0,0,$thismonth,$thisday,$thisyear) - $timeoffset * 3600;
- if ($discuz_user) {
- $lasthour = gmdate('H',$logintime + $timeoffset * 3600);
- if ($logintime < $todaylogincheck) {
- $periodoftime = 1 << $thishour;
- $db->unbuffered_query("UPDATE {$tablepre}members SET logintime='".$timestamp."', periodoftime ='".$periodoftime."' WHERE username='$discuz_user'");
- } elseif ($thishour > $lasthour) {
- $periodoftime = $periodoftime | (1 << $thishour);
- $db->unbuffered_query("UPDATE {$tablepre}members SET logintime='".$timestamp."', periodoftime ='".$periodoftime."' WHERE username='$discuz_user'");
- }
- }
- //End
复制代码
4.上传附件文件到论坛根目录
5.修改templates/default/header.htm
查找
- | <a href="faq.php" >{lang faq}</a>
复制代码
前面添加
- | <a href="membertoday.php">今日到访</a>
复制代码
[ 本帖最后由 咕咕 于 2005-12-18 11:58 编辑 ] |