检查当前用户是否是搜索引擎蜘蛛
函数代码:
<%
Function check(user_agent)
allow_agent=split("Baiduspider,Scooter,ia_archiver,Googlebot,bingbot,FAST-WebCrawler,MSNBOT,Slurp,YoudaoBot,Sogou+web+spider",",")
check_agent=false
For agenti=lbound(allow_agent) to ubound(allow_agent)
If instr(lcase(user_agent),lcase(allow_agent(agenti)))>0 then
check_agent=true
exit for
end if
Next
check=check_agent
End function
%>
使用方法:
<%
user_agent=Request.ServerVariables("HTTP_USER_AGENT")
if check(user_agent)=true then
response.write("This is a search engine spider!")
end if
%>