示例網址:http://www.firefox.net.cn/newforum/viewtopic.php?t=1953
如果你遇到問題。歡迎與我聯繫。
代碼: 選擇全部
##############################################################
## MOD Title: UserAgent MOD
## MOD Author: puhongyi < puhongyi@gmail.com > www.firefox.net.cn
## MOD Description: Record UserAgent (記錄用戶瀏覽器及系統標識)
## MOD Version: 1.0.0
## Example:http://www.firefox.net.cn/newforum/viewtopic.php?t=1953
## Installation Level: Easy
## Installation Time: 2 Minutes
## Files To Edit: includes/functions_post.php
## viewtopic.php
## templates\subSilver\viewtopic_body.tpl
## Included Files: (n/a)
##############################################################
##############################################################
## MOD History:
##
## 2005-01-20 - Version 1.0.0
## - Initial Release
##
##
##############################################################
## Before Adding This MOD To Your Forum, You Should Back Up All Files Related To This MOD
##安裝之前請先備份你的論壇。
##############################################################
#
#Mysql數據庫執行:
#
ALTER TABLE `phpbb_posts_text` ADD `user_agent` VARCHAR( 255 ) NOT NULL ;
#
#打開 includes/functions_post.php
#
#
#找到:--------------------------------------------------
#
$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message')" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
#
#替換為:------------------------------------------------
#
$UA=$_SERVER['HTTP_USER_AGENT'];
$sql = ($mode != 'editpost') ? "INSERT INTO " . POSTS_TEXT_TABLE . " (post_id, post_subject, bbcode_uid, post_text,USER_AGENT) VALUES ($post_id, '$post_subject', '$bbcode_uid', '$post_message','$UA' )" : "UPDATE " . POSTS_TEXT_TABLE . " SET post_text = '$post_message', bbcode_uid = '$bbcode_uid', post_subject = '$post_subject' WHERE post_id = $post_id";
#
#打開 viewtopic.php
#
#
#找到:-------------------------------------------------
#
FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
#
#替換為:-------------------------------------------------
#
, pt.user_agent FROM " . POSTS_TABLE . " p, " . USERS_TABLE . " u, " . POSTS_TEXT_TABLE . " pt
#
#找到:------------------------------------------------
#
'MESSAGE' => $message,
#
#之後加上:-------------------------------------------
#
'UA'=>htmlspecialchars($postrow[$i]['user_agent']),
#
#打開:templates\subSilver\viewtopic_body.tpl
#
#
#找到:---------------------------------------------
#
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
#
#替換為:--------------------------------------------
#
<td class="{postrow.ROW_CLASS}" width="100%" height="28" valign="bottom" nowrap="nowrap"><span class="gensmall" style='color: #9a9a9a;'>{postrow.UA}</span><table cellspacing="0" cellpadding="0" border="0" height="18" width="18">
#
#完畢。
#