까오기 카운터 2.2
=========================================================================== KKAOK count ver2.2 제작자 : kkaok ( jack1972@naver.com ) 홈페이지 : http://www.kkaok.pe.kr 날짜 : 2002년 10월 16일 =========================================================================== 1. 소스는 수정 배포 될수 있으며 수정 배포시 원 제작자를 명시하여야 한다. 2. 상업성 사이트에서의 사용은 금지한다. 3. 소스자체를 상업적(소스의 판매,대여등)으로 이용할 수 없다. 4. 이 프로그램의 사용으로 인한 어떠한 피해에도 제작자는 책임을 지지 않는다. 5. 이전 버전과의 다른점 - 에러처리만 조금 다릅니다.^^ 6. 현재 접속자수 추가 되었습니다. ■ 테스트 URL http://www.kkaok.pe.kr/ ■ 개발 환경 Windows 2000 , Tomcat3.2.3, oracle 8.1.6, jdk 1.3.1 ■ 테스트 환경 Windows 2000 , Tomcat3.2.3, oracle 8.1.6, jdk 1.3.1 ■ 설치방법 1. oracle을 실행하시고 kcount.sql에 있는 내용을 실행 시키세요 2. web-inf/classes/kr/pe/kkaok/pool/db.properties 이 화일의 내용을 자신의 환경에 맞게 고치세요 3. web-inf/classes/kr/pe/kkaok/common/config.java 이 화일의 내용을 자신의 환경에 맞게 고치세요 테스트 후 수정하셔도 상관없습니다. 4. 각 class 화일들을 컴파일하시고 테스트 하시면 됩니다. 5. test page : http://www.kkaok.pe.krTABLE SPEC(kcount)
| Column Name | Column Type | Null | 제약key | Description |
| idx | number | not null | pk,index | table의 고유값 이값의 최대값과 카운터 합계는 일치. |
| cdate | NUMBER(8) | not null | index | 접속날짜, 2002년 5월 15일이라면 20020515 |
| ctime | NUMBER(4) | not null | 접속시간, 3시 5분이라면 305 | |
| dayofweek | NUMBER(1) | not null | index | 접속요일,인덱스명 kcount_dayofweek_indx |
| ip | varchar2(20) | not null | 접속ip | |
| referer | varchar2(200) | referer 정보입력 | ||
| browser | varchar2(20) | not null | browser 정보입력 | |
| os | varchar2(20) | not null | os 정보입력 |
sql -------------------------------------------------------------------------- CREATE TABLE kcount ( idx number not null, cdate NUMBER(8), ctime NUMBER(4), dayofweek NUMBER(1), ip varchar2(20), referer varchar2(200), browser varchar2(20), os varchar2(20), constraint kcount_pk_idx Primary Key (idx) ); create index kcount_cdate_indx on kcount(cdate,idx); create index kcount_dayofweek_indx on kcount(dayofweek); 스크린샷 --------------------------------------------------------------------------
카운터올리기
--------------------------------------------------------------------------<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page import="java.util.*" %>
<%@ page import="kr.pe.kkaok.common.ErrException" %>
<jsp:useBean id="ct" scope="request" class="kr.pe.kkaok.count.Count" />
<%
try{
ct.todayCount(request,response);
}catch(ErrException er){
out.println(er.errMessage());
}
%>--------------------------------------------------------------------------
위의 소스를 user가 지나다니는 통로에 붙여 놓으세여
저의 경우 index.jsp에서 세개의 프레임을 나눠쓰고 있는데 그중 첫페이지인 index.jsp의 경우
모든 사람이 이곳을 경유하기 때문에 이곳에 붙여 놨습니다.
카운터보기
--------------------------------------------------------------------------
<%@ page contentType="text/html; charset=EUC-KR" %>
<%@ page import="java.util.*" %>
<%@ page import="kr.pe.kkaok.common.ErrException" %>
<%@ include file="/kcount/inc/refresh.jsp" %>
<jsp:useBean id="ct" scope="request" class="kr.pe.kkaok.count.Count" />
<jsp:useBean id="nct" scope="request" class="kr.pe.kkaok.count.NowCount" />
<%
int today = 0;
int total = 0;
int nowNum = 0;
try{
ct.getStatistics();
today = ct.getToday();
total = ct.getTotalSum();
nowNum = nct.getNowNum();
}catch(ErrException er){
out.println(er.errMessage());
}
%>
오늘의 카운터 : <%=today%>
전체 카운터 : <%=total%>
현재 접속자 : <%=nowNum%>
<a href="javascript:OpenWinCount('/servlet/count.Statics',520,520)">▒ 통계보기 ▒</a><br>
<script language="javaScript">
<!--
function OpenWinCount(URL,width,height) {
var str,width,height;
str="'toolbar=no,location=no,directories=no,status=no,menubar=no,scrollbars=yes,resizable=no,copyhistory=no,";
str=str+"width="+width;
str=str+",height="+height+"',top=150,left=250";
window.open(URL,'remote',str);
}
// --> </script>





