<% 'strConnString = "dsn=counter" 'set conn=server.CreateObject("ADODB.connection") 'conn.open strConnString set rs = server.createobject("ADODB.recordset") set rs2 = server.createobject("ADODB.recordset") HOST_NAME=UCASE(Request.ServerVariables("HTTP_HOST")) IP=Request.ServerVariables("REMOTE_ADDR") if (ip="220.134.61.12") or (mid(ip,1,8)="192.168.")then rs.Open "select * from HOSTNAME WHERE HOST_NAME='"&HOST_NAME&"'",conn,3,3 counter1=0 if not rs.eof then counter1=rs("COUNTER1") end if else rs.Open "select * from HOSTNAME WHERE HOST_NAME='"&HOST_NAME&"'",conn,3,3 counter1=0 counter2=0 if not rs.eof then HOST=Request.ServerVariables("REMOTE_HOST") if host="" then host=ip end if host_no=rs("HOST_NO") counter1=rs("COUNTER1")+1 counter2=rs("COUNTER2") rs2.Open "select * from LOG WHERE HOST_NO="&HOST_NO&" AND HOST='"&HOST&"' ORDER BY VIEWDATE DESC",conn,3,3 times=1 delta=0.0 if not rs2.eof then times=rs2("TIMES") delta=Now()-rs2("VIEWDATE") if delta>0.041 then times=times+1 counter2=counter2+1 end if else counter2=counter2+1 end if yy=year(now()) mm=month(now()) dd=day(now()) yys=cstr(yy) mms=cstr(mm) dds=cstr(dd) if len(mms)=1 then mms="0"&mms end if if len(dds)=1 then dds="0"&dds end if nowDatestr=yys&"/"&mms&"/"&dds hhs=cstr(hour(now())) mis=cstr(minute(now())) sss=cstr(second(now())) if len(hhs)=1 then hhs="0"&hhs end if if len(mis)=1 then mis="0"&mis end if if len(sss)=1 then sss="0"&sss end if nowTimestr=hhs&":"&mis&":"&sss rs2.addnew rs2("HOST_NO")=HOST_NO rs2("VIEWDATE")=Now() rs2("VIEWDATES")=NowDateStr rs2("VIEWTIMES")=NowTimeStr rs2("URL")=Request.ServerVariables("HTTP_REFERER") rs2("URL2")=Request("ref") rs2("IP")=ip rs2("HOST")=HOST host_domain="" host_unit="" if (ip<>HOST) and (len(host)>0) then c1=InstrRev(host,".", -1, 1) if c1>0 then host_domain=mid(host,c1+1,8) if InStr(host,"hknet.com")>0 then host_domain="hk" host_unit="com" else if len(host_domain)=2 then c1=InstrRev(mid(host,1,len(host)-3),".", -1, 1) if c1>0 then host_unit=mid(mid(host,1,len(host)-3),c1+1,10) end if else host_unit=host_domain host_domain="us" end if end if end if end if rs2("HOST_DOMAIN")=host_domain rs2("HOST_UNIT")=host_unit rs2("TIMES")=times rs2.update() rs2.close set rs2=nothing rs("COUNTER1")=counter1 rs("COUNTER2")=counter2 rs.update() end if end if rs.close set rs=nothing Conn.Close set Conn = nothing ' response.Write(""&counter1) response.Write("document.write('"&counter1&"');") %>