今天在網上看到防采集代碼,我把它放到這裡與大家共享。
此代碼的缺點是:也防了蜘蛛。
<%
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
%>