<%
‘设置重新验证时间,单位分钟。您可以把这个拿到global.asa中使用
application( "time_belimit_width ")=3
‘验证访问者的ip是否在危险ip库响
if instr( "58.61.164.140,58.61.164.138,58.61.164.139,58.61.164.141,58.61.164.142,219.135.238.224,122.0.194.122,58.61.90.0,221.218.239.53,220.181.19.164,219.135.238.224,219.235.240.136,219.235.240.136,202.106.182.157,61.140.123.146, ",request.ServerVariables( "REMOTE_ADDR ")& ", ") then
‘如果记录起始瞬间的cookie time_belimit_start为空,先置值,这是为了下面能正常使用
if request.cookies( "time_belimit_start ")= " " then
response.cookies( "time_belimit_start ")=(now()-application( "time_belimit_width ")*0.001)
end if
‘如果记录答案的cookie limitresult为wrong或者现在已经超过了前面定义的时长,才去执行算式验证
if request.cookies( "limitresult ")= "wrong " or abs(minute(now())-minute(FormatDateTime(request.cookies( "time_belimit_start "))))> application( "time_belimit_width ") then
‘设置cookie limitresult的初始值为wrong
response.cookies( "limitresult ")= "wrong "
‘设置起始时间为现在
response.cookies( "time_belimit_start ")=now()
‘取得随机数和随机数的和
randomize
belimit_first=Int((9 – 0 + 1) * Rnd + 1)
randomize
belimit_second=Int((9 – 0 + 1) * Rnd + 1)
belimit_result=belimit_first+belimit_second
‘提示验证信息
word_belimit_1= "对不起,您所在ip段曾经存在恶意抓取我们网页的行为,我们不得已采取授权访问制. "&_
"请根据提示回答问题,结果正确,您可以在 "&application( "time_belimit_width ")& "分钟内正常访问,结果错误,您将无法正确访问。 "
response.write(word_belimit_1 & "您访问的开始时间是: "&request.cookies( "time_belimit_start "))
‘设定表达式
word_belimit= "请问 "&belimit_first& "+ "&belimit_second& "= "
response.write( " <script language= ‘javascript ‘> ")
response.write( "var word_in; ")
response.write( "word_in=prompt( ‘ " & word_belimit & " ‘); ")
response.write( "document.write(word_in); ")
response.write( " if(word_in!= "&belimit_result& ") ")
response.write( " { ")
response.write( " document.write( ‘回答错误,谢谢使用。 ‘); ")
‘答案错误,转向百度搜索
response.write( " document.location.href= ‘http://www.baidu.com/s?wd=%C3%BF%C8%D5%C8%CB%B2%C5%CD%F8&cl=3 ‘; ")
response.write( " } ")
response.write( " else ")
response.write( " { ")
‘答案正确,设置cookie limitresult为“success”
response.write( " document.cookie= ‘limitresult=success ‘; ")
response.write( " } ")
response.write( " </script> ")
end if
end if
%>
评论前必须登录!
注册