add_action('wp_footer','deny_mirrored_websites');
function deny_mirrored_websites(){
$currentDomain = 'www.liming." + "hk'; //此处自行拆分一下自己的域名即可 如不需www二级可以去掉
echo '<img style="display:none" src=" " onerror=\'var str1="'.$currentDomain.'";str2="docu"+"ment.loca"+"tion.host";str3=eval(str2);if( str1!=str3 ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "\"' . $currentDomain .'\"" + ")";eval(do_action) }\' />';
}
<img style="display:none" src=" " onerror='var currentDomain="luoxiao123." + "cn"; var str1=currentDomain; str2="docu"+"ment.loca"+"tion.host"; str3=eval(str2) ;if( str1!=str3 ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + "currentDomain" + ")";eval(do_action) }' />
/**
*
**/
if(!is_admin()) {
add_action('init', 'deny_mirrored_request', 0);
}
function deny_mirrored_request()
{
$ua = $_SERVER['HTTP_USER_AGENT'];
if(!$ua || preg_match('/PHP/i', $ua)) {
header("Content-type: text/html; charset=utf-8");
wp_die('请勿采集本站,因为采集的站长木有小JJ!');
}
}
//防止恶意HTTP_USER_AGENT采集
add_action('wp_head', 'deny_mirrored_request', 0);
function deny_mirrored_request()
{
$ua = $_SERVER['HTTP_USER_AGENT'];
$now_ua = array('FeedDemon ','BOT/0.1 (BOT for JCE)','CrawlDaddy ','Java','Feedly','UniversalFeedParser','ApacheBench','Swiftbot','ZmEu','Indy Library','oBot','jaunty','YandexBot','AhrefsBot','MJ12bot','WinHttp','EasouSpider','HttpClient','Microsoft URL Control','YYSpider','jaunty','Python-urllib','lightDeckReports Bot','PHP');
if(!$ua) {
header("Content-type: text/html; charset=utf-8");
wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【龙笑天下网】官方网址!');
}else{
foreach($now_ua as $value )
if(eregi($value,$ua)) {
header("Content-type: text/html; charset=utf-8");
wp_die('请勿采集本站,采集者木有小JJ!请正常访问,并认准【李明個人網站】!');
}
}
}
相关阅读
留言咨询