RSS구독하기:SUBSCRIBE TO RSS FEED
즐겨찾기추가:ADD FAVORITE
글쓰기:POST
관리자:ADMINISTRATOR
Linux/개인서버Tip  2005/01/26 15:12
zerocounter 는 쉽게 설치하고 사용할수 있습니다.
다운받은후 압축을 풀고 index.html 이 있는 폴더로 올립니다.
그후 dbconn.php3 에서 db정보를 수정합니다.

http:/test.com/zerocount/admin.php3 로 접속하면 설치화면이 나옵니다.
소개-->설치-->사용법 순서대로 진행한후 mysql db에
counter_ip / counter_main / counter_repafer 이런 테이블이 생성됩니다.

자..이제 원하는 페이지에 삽입하는것만 남았습니다.

[CODE]<? include "zerocount/dbconn.php3"; include "zerocount/zerocounter.php3"; ?>[/CODE]

해당 페이지 맨위에 붙여넣으면 되겠습니다...

[CODE]<? $_zb_url = "http://test.com/bbs/"; $_zb_path = "/home/test/public_html/bbs/"; include $_zb_path."outlogin.php"; include "zerocount/dbconn.php3"; include "zerocount/zerocounter.php3"; ?> $count[total_hit] -> 전체 방문자수 $count[total_view] -> 전체 페이지뷰 $count[today_hit] -> 오늘의 방문자수 $count[today_view] -> 오늘 페이지뷰 $count[yesterday_hit] -> 어제 방문자수 $count[yesterday_view] -> 어제 페이지뷰 $count[max_hit] -> 최고 방문자수 $count[max_view] -> 최고 페이지뷰 $count[min_hit] -> 최저 방문자수 $count[min_view] -> 최저 페이지뷰 [/CODE]

예를 들겠습니다...

[CODE]<tr><td width="160" align="left"><p><font color="660033">전체방문자수 : <? echo 180000+"$count[total_hit]";?></font></p></td></tr> <tr><td width="160" align="left"><p><font color="660033">오늘방문자수 : <? echo "$count[today_hit]";?></font></p></td></tr> <tr><td width="160" align="left"><p><font color="660033">어제방문자수 : <? echo "$count[yesterday_hit]";?></font></p></td></tr> <tr><td width="160" align="left"><p><font color="660033">최고방문자수 : <? echo "$count[max_hit]";?></font></p></td></tr> <tr><td width="160" align="left"><p> <a href=# onclick="javascript:RWindow('zerocount/status.php3',0,0)"><font color="0066ff"> 통계보기 </font></a></p></td></tr>[/CODE]

[CODE]여기서 <? echo 180000+"$count[total_hit]";?> 180000+ 추가한것은 0부터 카운터 하는것이 아니고 180000 부터 카운터를 시작한다는 뜻이죠[/CODE]

통계보기는 좀더 자세한 통계페이지를 팝업창으로 여는 것입니다.

[CODE]<head></head>사이에 <script language='JavaScript'> function RWindow(URL,WD,HT) { window.open(URL,'counter','width=430,height=400,scrollbars=yes,resizable=0,status=no,menubar=0'); } </script>[/CODE]

넣어야 통계 팝업창을 띄웁니다...

php 제로카운터의 단점은 db를 사용하기 때문에 접속자수가 많아지면
계속에서 db사용량이 늘어난다는 점입니다..
ip주소와 referer를 계속 저장하기 때문이죠...
그래서 테이블을 비워줘야 하는데요...
다음과 같이 수정하면 ip주소와 referer 를 5일분만 저장하고 삭제 한다는
것입니다...물론 이렇게 해도 카운터에는 아무런 이상이 없습니다.

zerocounter.php3 를 다음과 같이 추가합니다..

//------------------- 카운터 값 읽어오는 부분 ----------------------------------------------------------------------
//수정한부분--자동으로 db값지우기--ip와 referer를 5일분량만 남기고 지우기
$date = 60 * 60 * 24 * 5;
mysql_query("delete from counter_ip where (".time()." - date) >= ".$date) or error(mysql_error());
mysql_query("delete from counter_referer where (".time()." - date) >= ".$date) or error(mysql_error());


// 전체
$total=mysql_fetch_array(mysql_query("select unique_counter, pageview from counter_main where no=1", $connect));
$count[total_hit]=$total[0];
$count[total_view]=$total[1];

|
|

아마..52번째 줄인가 그럴겁니다...수정한 부분이란 곳을 추가 했습니다.
설치를 마치면 admin.php3 파일을 적당한 이름으로 바꾸세요....
이파일은 누구나 열수 있으니까요...
이상...제로 카운터 설치와 수정법 이였습니다.
참..제로카운터의 출처는 당연히 http://www.nzeo.com 입니다.
크리에이티브 커먼즈 라이센스
Creative Commons License
2005/01/26 15:12 2005/01/26 15:12
http://cafeall.com/trackback/16
겔롱:리눅스와 Rc 전동비행기 그리고 지극히 개인적인 공간, 오토캠핑 이야기
리눅스와 Rc 전동비행기 그리고 지극히 개인적인 공간, 오토캠핑 이야기
전체 (494)
Linux (38)
Rc 이야기 (32)
오토캠핑 (60)
여행&소풍 (79)
나의 이야기 (275)
마눌님 이야기 (0)
겔롱이 궁금하신분 (1)
동영상 (3)
사진이야기 (5)
«   2012/05   »
    1 2 3 4 5
6 7 8 9 10 11 12
13 14 15 16 17 18 19
20 21 22 23 24 25 26
27 28 29 30 31