Asp判断蜘蛛来访的代码

 检查当前用户是否是搜索引擎蜘蛛

ASP/Visual Basic代码
  1. Function check(user_agent)  
  2.     allow_agent=split("Baiduspider,Scooter,ia_archiver,Googlebot,bingbot,FAST-WebCrawler,MSNBOT,Slurp,YoudaoBot,Sogou+web+spider",",")  
  3.     check_agent=false  
  4.     For agenti=lbound(allow_agent) to ubound(allow_agent)  
  5.         If instr(lcase(user_agent),lcase(allow_agent(agenti)))>0 then  
  6.             check_agent=true  
  7.             exit for  
  8.         end if  
  9.     Next  
  10.     check=check_agent  
  11. End function  

使用方法:

XML/HTML代码
  1. user_agent=Request.ServerVariables("HTTP_USER_AGENT")  
  2. if check(user_agent)=true then  
  3. response.write("This is a search engine spider!")  
  4. end if  

 



上一篇: 新浪博客文章自动发布工具
下一篇: VB文本框textbox双击全选
文章来自: 本站原创
引用通告: 查看所有引用 | 我要引用此文章
Tags: asp
相关日志:
评论: 0 | 引用: 0 | 查看次数: 2728
发表评论
昵 称:
密 码: 游客发言不需要密码.
邮 箱: 邮件地址支持Gravatar头像,邮箱地址不会公开.
网 址: 输入网址便于回访.
内 容:
验证码:
选 项:
虽然发表评论不用注册,但是为了保护您的发言权,建议您注册帐号.
字数限制 1000 字 | UBB代码 开启 | [img]标签 关闭

 广告位

↑返回顶部↑