以下介绍用数据库实现简单计数器
'下面存为count.asp
<%
Set conn=Server.CreateObject("ADODB.Connection")
conn.Open "driver={Microsoft Access Driver (*.mdb)};dbq="& Server.MapPath("count.mdb")
%
<%on error resume next%
<%sql="update count set hit=hit+1%<%conn.Execute(sql)%
<%sql = "select * from count
set rs=conn.execute(sql)
%
<%
'更新每周每日数据
lasthit=rs("lasthit")
tdate=year(Now()) & "-" & month(Now()) & "-" & day(Now())
if trim(lasthit)=trim(tdate) then...[ 查看全文 ]