作者:[转载]  文章来源:http://www.alixixi.com/  更新时间:2006-4-12
有时我们要限制用户重复刷新一个页面。很多站点对于录入操作都用验证码来限制恶意灌水。但是如果是在一套web管理系统中,执行一段没有界面的逻辑操作代码时,就不能用验证码了。我们一般用session来限制。下面就是一个包装的函数,用法很简单。


'SessionName session的名字
'SecondSpan 时间间隔(单位:秒)
function CanDoRepeat(SessionName,SecondSpan)
xx=timer()
if session(SessionName)="" then
session(SessionName)=xx
else
if xx-session(SessionName)<SecondSpan then
CanDoRepeat=false
else
session(SessionName)=xx
CanDoRepeat=true
end if
end if
end function
  • 上一篇:
  • 下一篇:
网友评论
相关搜索
阿里西西Baidu.com搜索