asp防止刷新,代碼如下:
Sub chkreflash()
dim ScriptName
ScriptName=lcase(request.ServerVariables("PATH_INFO"))
dim posttime,DoReflashPage,ReflashPage,SplitReflashPage
posttime=1 '防止刷新時(shí)間
DoReflashPage=false
ReflashPage="|Article_one.asp"
SplitReflashPage=split(ReflashPage,"|")
for i=0 to ubound(SplitReflashPage)
if instr(scriptname,SplitReflashPage(i))>0 then
DoReflashPage=true
exit for
end if
next
if (not isnull(session("ReflashTime"))) and posttime>0 and DoReflashPage then
if DateDiff("s",session("ReflashTime"),Now())<posttime then
call msg("警告!系統(tǒng)已記錄您的IP,和刷新次數(shù)。\n\n請(qǐng)不要在"&posttime&"秒內(nèi)連續(xù)刷新本頁面!","-1")
else
session("ReflashTime")=Now()
end if
elseif isnull(session("ReflashTime")) and posttime>0 and DoReflashPage then
Session("ReflashTime")=Now()
end if
End Sub
調(diào)用方法在頁面首部加入chkreflash即可
該文章在 2011/2/16 0:52:51 編輯過