Php code used to determine whether a visitor is a search engine or a real user

Source: Internet
Author: User
Php code used to determine whether a visitor is a search engine or a real user

  1. /**
  2. * Determine whether the access source search engine is a real user
  3. * Site bbs.it-home.org
  4. */
  5. Function is_bot ()
  6. {
  7. /* This function will check whether the visitor is a search engine robot */
  8. // Expand the array as needed
  9. $ Botlist = array ("Teoma", "alexa", "froogle", "Gigabot", "inktomi ",
  10. "Looksmart", "URL_Spider_ SQL", "Firefly", "NationalDirectory ",
  11. "Ask Jeeves", "TECNOSEEK", "InfoSeek", "WebFindBot", "girafabot ",
  12. "Crawler", "bbs.it-home.org", "Googlebot", "Scooter", "Slurp ",
  13. "Msnbot", "appie", "FAST", "WebBug", "Spade", "ZyBorg", "rabaz ",
  14. "Baiduspider", "Feedfetcher-Google", "TechnoratiSnoop", "Rankivabot ",
  15. "Mediapartners-Google", "Sogou web spider", "WebAlta Crawler", "TweetmemeBot ",
  16. "Butterfly", "Twitturls", "Me. dium", "Twiceler ");
  17. Foreach ($ botlist as $ bot)
  18. {
  19. If (strpos ($ _ SERVER ['http _ USER_AGENT '], $ bot )! = False)
  20. Return true; // Is a bot
  21. }
  22. Return false; // Not a bot
  23. }
  24. ?>

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.