日期:2014-05-17  浏览次数:20860 次

访问计数器为什么刷新一次却记录两次
<%
set rs1=server.CreateObject("adodb.recordset") 
rs1.open "select * from ["&TablePrefix&"counter] where id=1",conn,1,3 
if rs1.eof and rs1.bof then 
response.write "erry" 
else
hittime = rs1("hittime") 
dim dayNow,monthNow,weeknow 
dayNow = day(date())  
monthNow = month(date())  
weekNow = weekday(date())  
rs1("hits") = rs1("hits") + 1 
if datediff("d",hittime,now()) = 0 then  
rs1("hitsday") = rs1("hitsday") + 1  
else 
rs1("hitsday") = 1  
end if 

if monthNow = month(hittime) then 
rs1("hitmonths") = rs1("hitmonths") + 1 
else 
rs1("hitmonths") = 1  
end if 

if datediff("d",hittime,now()) > 6 then  
rs1("hitsweeks") = 1 
else 
if weekNow <> 1 then 
rs1("hitsweeks") = rs1("hitsweeks") + 1 
else 
weekNowss = weekday(hittime)  
if weekNow = weekNowss then
rs1("hitsweeks") = rs1("hitsweeks") + 1 
else 
rs1("hitsweeks") = 1 
end if 
end if 
end if 

rs1("hittime") = now()  
rs1.update
%>
总访问量:<%=rs1("hits")%>人 / 今日访问量:<%=rs1("hitsday")%>人 / 本周访问量:<%=rs1("hitsweeks")%>人 / 本月访问量:<%=rs1("hitmonths")%>人

------解决方案--------------------
把if--else-捋顺一下。判断太多了,估计是有逻辑错误。
------解决方案--------------------
ALTER 测试一下