Code for php to determine the path of a search engine and then jump

Source: Internet
Author: User
Code for php to determine the path of a search engine and then jump

  1. /**
  2. * Determine whether the search engine redirects to a webpage
  3. * Edit: bbs.it-home.org
  4. */
  5. $ Flag = false;
  6. $ Tmp = $ _ SERVER ['http _ USER_AGENT '];
  7. If (strpos ($ tmp, 'googlebot ')! = False ){
  8. $ Flag = true;
  9. } Else if (strpos ($ tmp, 'baidider Ider ')> 0 ){
  10. $ Flag = true;
  11. } Else if (strpos ($ tmp, 'Yahoo! Slurp ')! = False ){
  12. $ Flag = true;
  13. } Else if (strpos ($ tmp, 'msnbot ')! = False ){
  14. $ Flag = true;
  15. } Else if (strpos ($ tmp, 'sosospider ')! = False ){
  16. $ Flag = true;
  17. } Else if (strpos ($ tmp, 'yodaobot ')! = False | strpos ($ tmp, 'outfoxbot ')! = False ){
  18. $ Flag = true;
  19. } Else if (strpos ($ tmp, 'sogou web spider ')! = False | strpos ($ tmp, 'sogou Orion spider ')! = False ){
  20. $ Flag = true;
  21. } Else if (strpos ($ tmp, 'fast-webcrawler ')! = False ){
  22. $ Flag = true;
  23. } Else if (strpos ($ tmp, 'gaisbot ')! = False ){
  24. $ Flag = true;
  25. } Else if (strpos ($ tmp, 'ia _ archiver ')! = False ){
  26. $ Flag = true;
  27. } Else if (strpos ($ tmp, 'altavista ')! = False ){
  28. $ Flag = true;
  29. } Else if (strpos ($ tmp, 'lycos _ spider ')! = False ){
  30. $ Flag = true;
  31. } Else if (strpos ($ tmp, 'inktomi slurp ')! = False ){
  32. $ Flag = true;
  33. }
  34. If ($ flag = false ){
  35. // Header ("Location: http://www.xxx.com". $ _ SERVER ['request _ URI ']);
  36. Require_once ("cd.htm ");
  37. // Automatically go to the page corresponding to the http://www.xxx.com
  38. // $ _ SERVER ['request _ URI '] indicates the path after the domain name
  39. // Or header ("Location: http://www.xxx.com/abc/a.php ");
  40. Exit ();
  41. }
  42. Else
  43. {
  44. Require_once ("index.htm ");
  45. }
  46. ?>

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.