Asp判断蜘蛛来访的代码
作者:admin 日期:2012-05-23
检查当前用户是否是搜索引擎蜘蛛
ASP/Visual Basic代码
- 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
使用方法:
XML/HTML代码
- user_agent=Request.ServerVariables("HTTP_USER_AGENT")
- if check(user_agent)=true then
- response.write("This is a search engine spider!")
- end if
评论: 0 | 引用: 0 | 查看次数: 2728
发表评论
广告位