Determine the jump code (js and php) of the spider Code Black Hat Based on the user-agent, and the user-agentjs

Source: Internet
Author: User

Determine the jump code (js and php) of the spider Code Black Hat Based on the user-agent, and the user-agentjs

One of the techniques used by everyone in the black hat seo method is to judge the user-agent of the client browser on the server side and then perform further operations,

Someone has been using this code on the Internet for a long time. First, a js code is used to determine the visitor's path. If it is a search engine, the Code jumps. If it is a direct access, the Code remains unchanged. It has been found online for a long time. thanks to the original author

<script language="javascript">var pattern = /google/gi;var pattern1= /yahoo/gi;var keyValue=escape(document.referrer);if (pattern.exec(keyValue))setTimeout("windows.location='http://www.bkjia.com'",10*1000);else if(pattern1.exec(keyValue))setTimeout("window.location='http://www.bkjia.com'",10*1000);</script>

If it is a user-agent of the search engine, this method is used to redirect 301 to many spoofing links on the Internet (the code will be placed at the end)

There are still a lot of specific ideas, jump, Joe pages, etc. Today, only the code is put out of the php code

The declaration code is written by Baidu first.
Based on php's $ _ SERVER ['HTTP _ USER_AGENT '],

<? Php $ tmp = $ _ SERVER ['HTTP _ USER_AGENT ']; if (strpos ($ tmp, 'googlebot ')! = False) {echo 'Google ';} else if (strpos ($ tmp, 'baidider ider')> 0) {echo 'Baidu ';} else if (strpos ($ tmp, 'yahoo! Slurp ')! = False) {echo 'yahoo ';} else if (strpos ($ tmp, 'msnbot ')! = False) {echo 'msn ';} else if (strpos ($ tmp, 'sosospider ')! = False) {echo 'search';} else if (strpos ($ tmp, 'yodaobot ')! = False | strpos ($ tmp, 'outfoxbot ')! = False) {echo 'youdao ';} else if (strpos ($ tmp, 'sogou web spider ')! = False | strpos ($ tmp, 'sogou Orion spider ')! = False) {echo 'sogou ';} else if (strpos ($ tmp, 'fast-webcrawler ')! = False) {echo 'alltheweb';} else if (strpos ($ tmp, 'gaisbot ')! = False) {echo 'gais ';} else if (strpos ($ tmp, 'ia _ archiver ')! = False) {echo 'Alexa';} else if (strpos ($ tmp, 'altavista ')! = False) {echo 'altavista';} else if (strpos ($ tmp, 'lycos _ spider ')! = False) {echo 'lycos ';} else if (strpos ($ tmp, 'inktomi slurp ')! = False) {echo 'inktomi';}?>

Section 2 with jump

<? Php $ flag = false; $ tmp = $ _ SERVER ['HTTP _ USER_AGENT ']; if (strpos ($ tmp, 'googlebot ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'baidider ider ')> 0) {$ flag = true ;} else if (strpos ($ tmp, 'yahoo! Slurp ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'msnbot ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'sosospider ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'yodaobot ')! = False | strpos ($ tmp, 'outfoxbot ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'sogou web spider ')! = False | strpos ($ tmp, 'sogou Orion spider ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'fast-webcrawler ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'gaisbot ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'ia _ archiver ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'altavista ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'lycos _ spider ')! = False) {$ flag = true;} else if (strpos ($ tmp, 'inktomi slurp ')! = False) {$ flag = true;} if ($ flag = false) {header ("Location: http://www.bkjia.com ". $ _ SERVER ['request _ URI ']); // automatically go to the page corresponding to the http://www.bkjia.com // $ _ SERVER ['request _ URI '] For the path behind the domain name // or change to header ("Location: http://www.bkjia.com/abc/d.php "); exit () ;}?>

The third code is redirected to the last 301 after judgment.

if (preg_match(“#(google|slurp@inktomi|yahoo! slurp|msnbot)#si”, $_SERVER['HTTP_USER_AGENT'])) { header(“HTTP/1.1 301 Moved Permanently”);header(“Location: http://www.saoyu.com/”);exit; }}

Black Hat methods are risky and please use them with caution. If you are looking for a backdoor.

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.