Quote: http://140.111.66.34/modules/news/article.php?storyid=30
PHP i-Stats 是一套可以分析網站流量的 PHP 程式,它可以搭配 MySQL 資料庫來使用!
系統須求:Apache Web Server+PHP 4.x+MySQL 3.23 或更新的版本+GD 2.xPHP i-Stats 官方網站:http://www.my-code.org/
PHP i-Stats 下載:http://www.my-code.org/download.php
目前網站上可以下載的最新版本是 1.2 版
1.) 下載 PHP i-stats
wget http://www.my-code.org/get.php?filename=PHP_i-Stats_1.2.tgz
2.) 解開檔案
tar zxvf PHP_i-Stats_1.2.tgz -C /var/www/html/
3.)建立資料庫、使用者、匯入資料
grant all privileges on phpistats.* to phpistats@localhost identified by 'phpistats'
mysql -u phpistats -p phpistats phpistats < /var/www/html/PHP_i-Stats_1.2/sql/SQL_new_install.sql
4.) 修改設定檔
vi /var/www/html/PHP_i-Stats_1.2/include/config.inc.php
<?php
/* define database connection information */
$cfg['dbHost'] = "localhost"; // your database hostname
$cfg['dbUser'] = "phpistats"; // your database username
$cfg['dbPass'] = "phpistats"; // your database password
$cfg['dbName'] = "phpistats "; // your database name/* define general website inforamtion */
$cfg['sitename'] = "ssorc.tw";
$cfg['siteurl'][] = "http://ssorc.tw"; // list all of your possible url here
/* select language file in 'lang' directory */
$cfg['langFile'] = "english.php";/* choose pages counter's title options */
$cfg['pagestats'] = "fulladd"; // fulladd: url with _GET variables, like index.php?action=make
// filename: count with filename only, like index.php or article.php
// title: html title (not suggest for high performace website)
// DEFAULT: 'fulladd'/* set the permission for yor statistics */
$cfg['public'] = TRUE; // change it to FALSE if you don't want public your statistics$cfg['username'] = "admin"; // statistics access username and password, just ignore this if
$cfg['password'] = "password"; // you set $cfg['public'] to TRUE
?>
5.) 安裝這段 code 到網站原始程式裡
<script language="Javascript">
function replaceText(text){
while(text.lastIndexOf("&") > 0){
text = text.replace('&', '[i-Stats]');
}
return text;
}var web_referrer = replaceText(document.referrer);
<!–
istat = new Image(1,1);
istat.src =
"http://ssorc.tw/phpistats/counter.php?sw="+screen.width+"&sc="+screen.colorDepth+"&referer="+web_referrer+"&page="+location.href;
//–>
</script>
6.) 瀏覽 http://ssorc.tw/phpistats
Q:) 一段錯誤訊息
Warning: mysql_fetch_array(): supplied argument is not a valid MySQL result resource in /var/www/html/PHP_i-Stats_1.2/include/database.class.php on line 70
A:)
這個原來是 config.inc.php 的資料庫項多了空白造成的,害我找了很久,搞不懂為什麼,暈,其實在首頁下面已有再提示沒有資料庫選擇,(就是腦筋轉不過來 – -)
留言