asp防采集提高代码二

再来一段asp 防采集代码,自己测试!

vb 代码
 
  1. <%
  2. user_agent=Request.ServerVariables("HTTP_USER_AGENT")
  3. http_reffer=Request.ServerVariables("HTTP_REFERER")
  4. server_name=Request.ServerVariables("SERVER_NAME")
  5. '检查当前用户是否是蜘蛛
  6.  
  7. function check(user_agent)
  8.   allow_agent=split("Baiduspider,Scooter,ia_archiver,Googlebot,FAST-WebCrawler,MSNBOT,Slurp",",")
  9.   check_agent=false
  10.   for agenti=lbound(allow_agent) to ubound(allow_agent)
  11.   if instr(user_agent,allow_agent(agenti))>0 then
  12. check_agent=true

  13.   exit for
  14.   end if
  15.   next
  16.   check=check_agent
  17. end function
  18. if check(user_agent)=False then
  19. if http_reffer="" or left(http_reffer,len("http://"&server_name)+1)<>"http://"&server_name"/" then
  20. %>
  21. <html><body>
  22. <form action='' name=checkrefer id=checkrefer method=post>
  23. </form>
  24. <script>
  25. document.all.checkrefer.action=document.URL;
  26. document.all.checkrefer.submit();
  27. </script>
  28. </body></html>
  29. <%
  30. response.end
  31. end if
  32. end if
  33. %>