WordPress 教程:WordPress 防镜像代码记录

 

代码如下:(复制粘贴到主题的 functions. 最后一个?>之前)

  1. /**
  2. * 被恶意镜像怎么办
  3. * 代码来自 https://www.ilxtx.com/mirrored-website.
  4. * 最后更新时间:20171022 发布时间:20160912
  5. * 出自:zhangge.net
  6. */
  7. add_action('wp_footer','lxtx_deny_mirrored_websites');
  8. function lxtx_deny_mirrored_websites(){
  9. $currentDomain = 'www" + ".ilxtx." + "com';
  10. // $currentDomain = '"zhangge." + "net"';
  11. echo '<img style="display:none" src=" " onerror='this.onerror=null;var str1="'.$currentDomain.'";str2="docu"+"ment.loca"+"tion.host";str3=eval(str2);if( str1!=str3 && str3!="cache.baiducontent.com" && str3!="webcache.usercontent.com" && str3!="c.360webcache.com" && str3!="cncc.bingj.com" && str3!="snapshot.sogoucdn.com" ){ do_action = "loca" + "tion." + "href = loca" + "tion.href" + ".rep" + "lace(docu" +"ment"+".loca"+"tion.ho"+"st," + ""' . $currentDomain .'"" + ")";eval(do_action) }' />';
  12. }
胜象大百科