<%
set conn=server.createobject("ADODB.CONNECTION")
provider="provider=microsoft.jet.OLEDB.4.0;"
DBPath="data source="&server.MapPath("mydb.mdb")
conn.open provider&DBPath
set rs=server.createobject("ADODB.recordset")
sql="select * from count1"
rs.open sql,conn,2,2
if session("hit")<>true then
rs("hit")=rs("hit")+1
rs.update
%>
<%
'更新日浏览量
lasthit=rs("lasthit")
tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
if trim(lasthit)=trim(tdate) then
rs("dayhit")=rs("dayhit")+1
rs.update
else
rs("dayhit")=1
rs("lasthit")=tdate
end if
'更新周浏览量
n=datepart("ww",date)
if n=rs("week") then
rs("weekhit")=rs("weekhit")+1
rs.update
else
rs("weekhit")=1
rs("week")=n
rs.update
end if
%>
<%
'更新月浏览量
m=datepart("m",date)
if m=rs("month") then
rs("monthhit")=rs("monthhit")+1
rs.update
else
rs("monthhit")=1
rs("month")=m
rs.update
end if
session("hit")=true
%>
<%end if%>