在餅乾大事紀 那兒看到了一個純文字的訪客計數器 Counterize,可以顯示的參數相當多,您可以參考本站下方
Total Hits:37 | Total Hits Today:2 | IP Visited:29 | Unique referers:17
Total Hit:本站點擊數
Total Hits Today:今日點擊數
IP Visited:IP 訪問數
Unique referers:被連結數
而這一個 Plug-in 的安裝方式可以參考 Counterize Installation,或是參考本站的安裝說明:
1.先取得 Counterize 原始程式(另存新檔後,存為 counterize.php),並放至 wp-content/plugins/Counterize
2.取得以下四個圖檔,並存至 wp-content/plugins/Counterize 目錄下
image1 | image2 | image3 | image4
3.在管理頁面啟用這個 Plugin
4.啟用後可能會遇到錯誤訊息,那是因為記錄 Countrize 資料表沒有被正確建立,這時候需要進入資料庫手動建立 Countrize 資料表
(
id integer not null auto_increment,
IP varchar(16) not null default ‘unknown’,
timestamp datetime not null default ‘now()’,
url varchar(255) not null default ‘unknown’,
referer varchar(255) not null default ‘unknown’,
useragent text,
primary key(id)
)
將 %s 取代為你的 WordPress 前置字串,例如 wp_Counterize
如果在建立資料表的時候,遇到錯誤訊息
原因是你的資料庫無法在 datetime 欄位中接受 now() 的預設值,請改用以下的 SQL Command
CREATE TABLE `wp_Counterize` (
`id` int(11) NOT NULL auto_increment,
`IP` varchar(16) NOT NULL default ‘unknown’,
`timestamp` datetime NOT NULL,
`url` varchar(255) NOT NULL default ‘unknown’,
`referer` varchar(255) NOT NULL default ‘unknown’,
`useragent` text,
PRIMARY KEY (`id`)
)
5.接下來,就是決定要把計數器顯示到畫面的那一個地方了,在這裡,你需要決定要顯示的參數,然後把這個參數寫到模版(外觀 -> 佈景主題編輯器)中,例如本站的參數
“ | Total Hits Today:“.counterize_gethitstoday() .
“ | IP Visited:“.counterize_getuniqueamount() .
“ | Unique referers:" . counterize_getuniquereferers()."“;
?>
6.Countrize 計數器參數列表
– Returns amount of unique URl’s that have been shown
echo counterize_getamount()
– Returns total hits seen by Counterize.
echo counterize_gethitstoday()
– Returns total hits registered today.
echo counterize_getuniquebrowsers()
– Returns amount of unique browser-strings that have visited.
echo counterize_getuniquereferers()
– Returns amount of unique referers that’s registered.
echo counterize_getlatest7days()
– Returns total amount of hits from the last 7 days.
echo counterize_getuniqueamount()
– Returns total unique IP’s that’s been seen.
echo counterize_getfromcurrentip()
– Returns total hits from the IP that’s visiting.
echo counterize_getuniquehitstoday()
– Returns the number of different IP’s registered today.
echo counterize_gethitstodayfromcurrentip()
– Returns daily hits from the IP that’s visiting.
echo counterize_return_first_hit()
– Returns the date of the first registrated entry in the database.
counterize_most_visited_pages()
– Create graph of most visited pages.
counterize_most_visited_ips()
– Create graph of most active IPs.
counterize_most_used_browsers()
– Create graph of most seen useragents.
SQL 語法:
CREATE TABLE % sCounterize(
id integer NOT NULL AUTO_INCREMENT ,
IP varchar( 16 ) NOT NULL default ‘unknown’,
timestamp datetime NOT NULL default ‘now()’,
url varchar( 255 ) NOT NULL default ‘unknown’,
referer varchar( 255 ) NOT NULL default ‘unknown’,
useragent text,
PRIMARY KEY ( id )
)
MySQL 傳回:
#1064 – You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near ‘%sCounterize
(
id integer not null auto_increment,
IP varchar(16) not nul’ at line 1
迴響 by 原罪 — 一月 22, 2008 @ 10:53 上午
小弟只能執行CREATE TABLE `wp_Counterize`的語法版本.
迴響 by 原罪 — 一月 22, 2008 @ 10:59 上午
那一個 %s 我有說明哦,請看上面有一行
“將 %s 取代為你的 WordPress 前置字串,例如 wp_Counterize"
迴響 by shinnlu — 一月 24, 2008 @ 2:56 下午
你好,我想請問一下他可以手動去修改現在的總人數嗎???
找很久都找不到
迴響 by muki — 七月 24, 2008 @ 9:39 上午
我沒有去追程式碼,不過計數器的原理就是把每一個訪客的讀取記錄下來
再加以分析,就得到網頁下面那幾個數字
如果要灌水的話,可以修改這一個 function counterize_getamount()
迴響 by shinnlu — 七月 27, 2008 @ 1:25 上午