$newthreads = round(($timestamp - $lastvisit + 600) / 1000) * 1000;
$today = mktime (0,0,0,date("m") ,date("d"),date("Y"));
$build_date = mktime (0,0,0,9,9,2007);//請修改後面的三個數字,分別代表你論壇運行第一天的月,日,年。
$build_days = (int)(($today-$build_date)/(24*3600));
//----首頁四格代碼開始
$colorarray = array('', 'red', 'orange', 'yellow', 'green', 'cyan', 'blue', 'purple', 'gray');
//新貼
$hack_cut_str = 26; //標題字數
$hack_cut_strauthor = 9;
$new_post_threadlist = array();
$nthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid ORDER BY t.dateline DESC LIMIT 0, 10");
while($nthread = $db->fetch_array($query)) {
$nthread['forumname'] = ereg_replace('<[^>]*>','',$nthread['name']);
$nthread['view_subject'] = cutstr($nthread['subject'],$hack_cut_str);
$nthread['view_author'] = cutstr($nthread['author'],$hack_cut_strauthor);
$nthread['date']= gmdate("$dateformat $timeformat", $nthread['dateline'] + $timeoffset * 3600);
$nthread['lastreplytime']= gmdate("$dateformat $timeformat", $nthread[lastpost] + ($timeoffset * 3600));
if($nthread['highlight']) {
$string = sprintf('%02d', $nthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$nthread['highlight'] = 'style="';
$nthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$nthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$nthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$nthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$nthread['highlight'] .= '"';
} else {
$nthread['highlight'] = '';
}
$new_post_threadlist[] = $nthread;
}
//新回覆
$hack_cut_str = 26; //標題字數
$hack_cut_strauthor = 9;
$new_reply_threadlist = array();
$rthread = array();
$query = $db->query("SELECT t.*, f.name FROM {$tablepre}threads t, {$tablepre}forums f WHERE t.fid<>'$fid' AND f.fid=t.fid AND t.closed NOT LIKE 'moved|%' AND t.replies !=0 ORDER BY t.lastpost DESC LIMIT 0, 9");
while($rthread = $db->fetch_array($query)) {
$rthread['forumname'] = ereg_replace('<[^>]*>','',$rthread['name']);
$rthread['view_subject'] = cutstr($rthread['subject'],$hack_cut_str);
$rthread['view_lastposter'] = cutstr($rthread['lastposter'],$hack_cut_strauthor);
$rthread['date']= gmdate("$dateformat $timeformat", $rthread['dateline'] + $timeoffset * 3600);
$rthread['lastreplytime']= gmdate("$dateformat $timeformat", $rthread[lastpost] + ($timeoffset * 3600));
if($rthread['highlight']) {
$string = sprintf('%02d', $rthread['highlight']);
$stylestr = sprintf('%03b', $string[0]);
$rthread['highlight'] = 'style="';
$rthread['highlight'] .= $stylestr[0] ? 'font-weight: bold;' : '';
$rthread['highlight'] .= $stylestr[1] ? 'font-style: italic;' : '';
$rthread['highlight'] .= $stylestr[2] ? 'text-decoration: underline;' : '';
$rthread['highlight'] .= $string[1] ? 'color: '.$colorarray[$string[1]] : '';
$rthread['highlight'] .= '"';
} else {
$rthread['highlight'] = '';
}
$new_reply_threadlist[] = $rthread;
}
//----首頁四格代碼結束
<!-- 首頁四格代碼開始 -->
<style type="text/css">
td.4r { width: 25%; }
td.bg4r { background: #FFF url("images/default/portalbox_bg.gif"); background-repeat: repeat-x; background-position: 0 1px; }
</style>
<div class="mainbox">
<span class="headactions">
<img id="page4_img" src="images/default/collapsed_no.gif" title="收起/展開" alt="收起/展開" onclick="toggle_collapse('page4');" />
</span>
<h1>$bbname 的資訊</h1>
<table summary="$bbname 的資訊" id="page4" cellspacing="0" cellpadding="0">
<thead class="category">
<tr>
<td class="4r" width="25%">個人資料</td>
<td class="4r" width="25%">論壇資訊</td>
<td class="4r" width="25%">最新發表</td>
<td class="4r" width="25%">最新回帖</td>
</tr>
</thead>
<tr>
<td valign="top" class="bg4r">
<!--{if !$discuz_user}-->
<form method="post" name="login" action="logging.php?action=login">
<input type="hidden" name="formhash" value="{FORMHASH}">
<input type="hidden" name="referer" value="$referer">
<b>請即 <a href="register.php">{lang register}</a> 成為{lang memberlist}:</b>
<br>
請先<b> <a href="register.php">{lang register}</a> </b>成為本論壇會員<br>以獲得會員權限<br>
<br>
<br><br>
<a href="index.php">$bbname</a> 會員登陸:<br>
{lang username}:<input type="text" name="username" size="14" maxlength="15" tabindex="1">
<br>
{lang password}:<input type="password" name="password" size="14" tabindex="2"><br>
<button type="submit" name="loginsubmit" tabindex="4" class="submit">{lang submit}</button> 或 <a href="$link_login">安全{lang login}</a>
</form>
<!--{/if}-->
<!--{if $discuz_uid}-->
<b>$discuz_userss</b> <!--{if $allowinvisible}--><!--{if !empty($invisible)}-->[<a href="member.php?action=switchstatus" title="{lang login_switch_normal_mode}">{lang login_invisible_mode}</a>]<!--{else}-->[<a href="member.php?action=switchstatus" title="{lang login_switch_invisible_mode}">{lang login_normal_mode}</a>]<!--{/if}--><!--{/if}--><br>
{lang index_status} :<span class="bold"><!--{if $validdays}--><a href="member.php?action=groupexpiry"><span class="bold">$grouptitle</span>($validdays)</a><!--{else}--><span class="bold">$grouptitle</span><!--{/if}--></span> <br>
{lang lastvisit}:<span class="bold">$lastvisittime</span><br>
{lang credits} :<a class="dropmenu" id="creditlist" onmouseover="showMenu(this.id)">$credits</a><br>
IP :<span class="bold">$onlineip</span> <br>
{lang pm}:
<!--{if $newpm ==0}-->沒有新{lang pm}<!--{else}-->
<a href="pm.php" target=_bank>?#64<span class="bold"> $newpmnum</span> 條新訊息</a><!--{/if}--><br>
<a href="search.php?srchfrom=$newthreads&searchsubmit=yes" title="{lang show_newthreads}">新帖</a> |
<a href="member.php?action=markread" title="{lang mark_read}">標讀</a> | <a href="my.php?item=threads" title="{lang show_mytopics}">我帖</a> | <a href="digest.php" title="{lang digest}">精華</a> | <!--{if $allowuseblog}--><a href="blog.php?uid=$discuz_uid" target="_blank">{lang blog}</a>
<br>搜索帖子<br><input type="text" name="searchbox1" value="在此輸入內容" size="20" class="altbg2" onfocus="this.value=''"> <input class="button" type="button" value="搜索" style="height: 1.8em" onclick="window.open('search.php?srchtxt='+$('searchbox1').value+'&searchsubmit=yes');">
<br>或可使用 <b><a href="search.php">高級搜索</a><b>
<!--{/if}-->
<!--{/if}-->
</td>
<td valign="top" class="bg4r">
今日發表{lang total}: $todayposts 篇<br>
昨日發表{lang total}: $postdata[0] 篇<br>
發表主題{lang total}: <span class="bold">$threads</span> 篇<br>
帖子總數{lang total}: <span class="bold">$posts</span> 篇<br>
會員總數: <span class="bold">$totalmembers</span> 人 <br>
是日到訪會員: <span class="bold">{if $todayvisit}$todayvisit{else} 0 {/if}</span> 人 <br>
是日加入會員: <span class="bold">{if $todaynewmems}$todaynewmems</span>{else} 0{/if}</span> 人<br>
線上人數: <span class="bold">$onlinenum</span> 人<br>
{lang welcome_newmember}?#64: <a href="space.php?action=viewpro&username=$lastmember"><font face="Impact">$lastmember</font></a><br>
smallzone成立日數: <span class="bold">$build_days</span> 天
</td>
<td valign="top" class="bg4r">
<!--{loop $new_post_threadlist $nthread}-->
<!--{if $nthread[replies]}-->
<a href="redirect.php?tid=$nthread[tid]&goto=newpost" title="最新話題 {LF}文章版區: $nthread[forumname]{LF}文章主題: $nthread[subject]{LF}文章{lang author}: $nthread[author]{LF}發表{lang time}: $nthread[date]{LF}瀏覽次數: $nthread[views] 次 {LF}{lang replies}次數: $nthread[replies] 次{LF}最後回覆: $nthread[lastreplytime]{LF}{lang lastpost}: $nthread[lastposter]" $nthread[highlight]>$nthread[view_subject]</a>
<!--{else}-->
<a href="redirect.php?tid=$nthread[tid]&goto=newpost" title="最新話題 {LF}文章版區: $nthread[forumname]{LF}文章主題: $nthread[subject]{LF}文章{lang author}: $nthread[author]{LF}發表{lang time}: $nthread[date]{LF}瀏覽次數: $nthread[views] 次{LF}{lang replies}次數: 暫時沒有回覆" $nthread[highlight]>$nthread[view_subject]</a><!--{/if}-->
$nthread[multipage]<br>
<!--{/loop}-->
</td>
<td valign="top" class="bg4r">
<!--{loop $new_reply_threadlist $rthread}-->
<a href="redirect.php?tid=$rthread[tid]&goto=lastpost#lastpost" title="最新回覆 {LF}文章版區: $rthread[forumname]{LF}文章主題: $rthread[subject]{LF}文章{lang author}: $rthread[author]{LF}發表{lang time}: $rthread[date]{LF}瀏覽次數: $rthread[views] 次{LF}{lang replies}次數: $rthread[replies] 次{LF}最後回覆: $rthread[lastreplytime]{LF}{lang lastpost}: $rthread[lastposter]" $rthread[highlight]>$rthread[view_subject]</a>
$rthread[multipage]<br>
<!--{/loop}--></td>
</tr>
</table>
</div>
<!-- 首頁四格代碼結束 -->
<!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a> <!--{else}--><a href="space.php?action=viewpro&uid=$discuz_uid" class="dropmenu" id="creditlist" onmouseover="showMenu(this.id)">$discuz_user</a> <!--{/if}-->
<!--{if $gid || !$discuz_uid}--><a href="$indexname">$bbname</a> <!--{else}--><a href="space.php">$discuz_user</a> <!--{/if}-->