<!--#include file="inc/conn.asp"-->
<%
call yecaosql()
SET rs=Server.CreateObject("ADODB.Recordset")
Rs.Open "Select * From [YC_tongji]" ,conn,1,3
if Request.Cookies("IsFirst")=fail then
LASTIP=RS("LASTIP")
NEWIP=REQUEST.servervariables("REMOTE_ADDR")
IF CSTR(Month(RS("DATE"))) <> CSTR(Month(DATE())) THEN
RS("DATE")=DATE()
RS("YESTERDAY")=RS("TODAY")
RS("BMONTH")=RS("MONTH")
RS("MONTH")=1
RS("TODAY")=1
RS.Update
ELSE
IF CSTR(Day(RS("DATE"))) <> CSTR(Day(DATE())) THEN
RS("DATE")=DATE()
RS("YESTERDAY")=RS("TODAY")
RS("TODAY")=1
RS.Update
END IF
response.Cookies("IsFirst")=true
END IF
RS("LASTIP")=NEWIP
RS("TOTAL")=RS("TOTAL")+1
RS("TODAY")=RS("TODAY")+1
RS("MONTH")=RS("MONTH")+1
RS.Update
end if
t=(cint(day(date()))*24+cint(hour(time())))*60+cint(minute(time()))
k=0
i=1
y=0
Do While application("zxip"&i)<>""
if application("zxip"&i)=Request.ServerVariables("REMOTE_ADDR")  then
application("zxsj"&i)=t
y=1
end if
if t-application("zxsj"&i)>9 or t<application("zxsj"&i) then
k=k+1
else
if k>0 then
application.lock
application("zxip"&i-k)=application("zxip"&i)
application("zxsj"&i-k)=application("zxsj"&i)
application.unlock
end if
end if
if k>0 then
application.lock
application("zxip"&i)=""
application.unlock
end if
i=i+1
loop
if y=0 then
application("zxip"&i)=Request.ServerVariables("REMOTE_ADDR")
application("zxsj"&i)=t
else
i=i-1
end if
online=i
N = Now
D1 = rs("inputdate")   
D2 = DateValue(N)
D3 = DateDiff("d", D1, D2)
response.write "document.write('<font class=""tongji"" title="""
response.write "<font color=#ff6600><b>↓来 访 I P 统 计↓</b></font><br>"
response.write  "&nbsp;开始统计："&D1&""
response.write  "<br>&nbsp;全部访问："
GCounter(RS("TOTAL"))
response.write  "<br>&nbsp;本月访问："
GCounter(RS("MONTH"))
response.write  "<br>&nbsp;上月访问："
GCounter(RS("BMONTH"))
response.write  "<br>&nbsp;今日访问：<font color=#ff6600><b>"
GCounter(RS("TODAY"))
response.write  "</b></font><br>&nbsp;昨日访问："
GCounter(RS("YESTERDAY"))
N = Now
D2 = DateValue(N)
D1 = rs("inputdate")                                                   ' 开始统计日期(月/日/年)
response.write  "<br>&nbsp;共运行了："
GCounter(DateDiff("d", D1, D2))
response.write  " 天"
D3=DateDiff("d",D1,D2)
response.write  "<br>&nbsp;平均每天："
GCounter(formatnumber(RS("TOTAL")/D3,0))
response.write  " 个"">访问统计</font>');"
rs.Close
set rs=nothing
Function GCounter(counter)
   Dim S, i, G
   S = CStr(counter)

   For i = 1 to Len(S)
      G = G & "" & Mid(S, i, 1) & ""
   Next
   response.write G
End Function
call closedata()
%>