mode = LCASE(Request("mode"))
Set conn = Server.CreateObject("ADODB.Connection")
DBPath = Server.MapPath("lianxi.mdb")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq=" & DBPath
SET rs = Server.CreateObject("ADODB.Recordset")
Rs.Open "Select * From counters" , conn,1,3
IF CSTR(Month(RS("DATE"))) <> CSTR(Month(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("BMONTH") = RS("MONTH")
RS("MONTH") = 0
RS("TODAY") = 0
RS.Update
ELSE
IF CSTR(Day(RS("DATE"))) <> CSTR(Day(DATE())) THEN
RS("DATE") = DATE()
RS("YESTERDAY") = RS("TODAY")
RS("TODAY") = 0
RS.Update
END IF
END IF
RS("TOTAL") = RS("TOTAL") + 1
RS("TODAY") = RS("TODAY") + 1
RS("MONTH") = RS("MONTH") + 1
RS.Update
response.write "<font size=2 color=000099>今日浏览总人数:</font>"
numshow( RS("TODAY") )
response.write "<br>"
response.write "<font size=2 color=000099>昨日浏览总人数:</font>"
numshow( RS("YESTERDAY") )
response.write "<br>"
response.write "<font size=2 color=000099>本月浏览总人数:</font>"
numshow( RS("MONTH") )
response.write "<br>"
response.write "<font size=2 color=000099>上月浏览总人数:</font>"
numshow( RS("BMONTH") )
response.write "<br>"
response.write "<font size=2 color=000099>本站浏览总人数:</font>"
numshow( RS("TOTAL") )
response.write "<br>"
response.write "</td>"
response.write "<td valign=""top"">"
N = Now
D2 = DateValue(N)
D1 = #09/01/2004# ' 开始统计日期(月/日/年)
response.write "<font size=2 color=000099>开站至今天的总天数:</font>"
numshow( DateDiff("d", D1, D2) )
response.write "<br>"
D3 = DateDiff("d", D1, D2)
response.write "<font size=2 color=000099>平均人数/日:</font>"
numshow( RS("TOTAL")\D3 )
CONN.CLOSE
Function numshow( counter )
Dim S, i, G
S = CStr( counter )
For i = 1 to Len(S)
G = G & "<IMG SRC=./gif/" & Mid(S, i, 1) & ".gif Align=middle>"
Next
response.write G
End Function
[此贴子已经被作者于2006-1-20 18:44:38编辑过]