ASP实现防止网站被采集代码
程序员文章站
2022-03-31 14:01:21
复制代码 代码如下:<% dim appealnum,appealcount appealnum=10 '同一ip60秒内请求限制10次 appealcount=re...
复制代码 代码如下:
<%
dim appealnum,appealcount
appealnum=10 '同一ip60秒内请求限制10次
appealcount=request.cookies("appealcount")
if appealcount="" then
response.cookies("appealcount")=1
appealcount=1
response.cookies("appealcount").expires=dateadd("s",60,now())
else
response.cookies("appealcount")=appealcount+1
response.cookies("appealcount").expires=dateadd("s",60,now())
end if
if int(appealcount)>int(appealnum) then
response.write "抓取很累,歇一会儿吧!"
response.end
end if
%>