beign主题给网站添加go跳转Base64加密效果

将一下代码保存为go.php放置在网站根目录下即可

  1. <?php
  2. if(strlen($_SERVER['REQUEST_URI'])?>?384?||
  3. ????strpos($_SERVER['REQUEST_URI'],?"eval(")?||
  4. ????strpos($_SERVER['REQUEST_URI'],?"base64"))?{
  5. ????????@header("HTTP/1.1?414?Request-URI?Too?Long");
  6. ????????@header("Status:?414?Request-URI?Too?Long");
  7. ????????@header("Connection:?Close");
  8. ????????@exit;
  9. }
  10. //通过QUERY_STRING取得完整的传入数据,然后取得url=之后的所有值,兼容性更好
  11. $t_url?=?preg_replace('/^url=(.*)$/i','$1',$_SERVER["QUERY_STRING"]);
  12. //此处可以自定义一些特别的外链,不需要可以删除以下5行
  13. if($t_url=="zhangge"?)?{
  14. ???$t_url="https://zhangge.net";
  15. }?elseif($t_url=="baidu")?{
  16. ???$t_url="http://localhost/4/hao/bb.html/";
  17. }
  18. //数据处理
  19. if(!empty($t_url))?{
  20. ????//判断取值是否加密
  21. ????if?($t_url?==?base64_encode(base64_decode($t_url)))?{
  22. ????????$t_url?=??base64_decode($t_url);
  23. ????}
  24. ????//对取值进行网址校验和判断
  25. ????preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i',$t_url,$matches);
  26. ????if($matches){
  27. ????????$url=$t_url;
  28. ????????$title='页面加载中,请稍候...';
  29. ????}?else?{
  30. ????????preg_match('/\./i',$t_url,$matche);
  31. ????????if($matche){
  32. ????????????$url='http://'.$t_url;
  33. ????????????$title='页面加载中,请稍候...';
  34. ????????}?else?{
  35. ????????????$url?=?'http://'.$_SERVER['HTTP_HOST'];
  36. ????????????$title='参数错误,正在返回首页...';
  37. ????????}
  38. ????}
  39. }?else?{
  40. ????$title?=?'参数缺失,正在返回首页...';
  41. ????$url?=?'http://'.$_SERVER['HTTP_HOST'];
  42. }
  43. ?>
  44. <html>
  45. <head>
  46. <meta?http-equiv="Content-Type"?content="text/html;?charset=UTF-8">
  47. <meta?name="robots"?content="noindex,?nofollow"?/>
  48. <noscript><meta?http-equiv="refresh"?content="1;url='<?php?echo?$url;?>';"></noscript>
  49. <script>
  50. function?link_jump()
  51. {
  52. ????//禁止其他网站使用我们的跳转页面
  53. ????var?MyHOST?=?new?RegExp("<?php?echo?$_SERVER['HTTP_HOST'];??>");
  54. ????if?(!MyHOST.test(document.referrer))?{
  55. ?????????location.href="http://"?+?MyHOST;
  56. ????}
  57. ????location.href="<?php?echo?$url;?>";
  58. }
  59. //延时1S跳转,可自行修改延时时间
  60. setTimeout(link_jump,?1000);
  61. //延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
  62. setTimeout(function(){window.opener=null;window.close();},?50000);
  63. </script>
  64. <title><?php?echo?$title;?></title>
  65. <style?type="text/css">
  66. html,body,div,span,applet,object,iframe,h1,h2,h3,h4,h5,h6,p,blockquote,pre,a,abbr,acronym,address,big,cite,code,del,dfn,em,img,ins,kbd,q,s,samp,small,strike,strong,sub,sup,tt,var,b,u,i,center,dl,dt,dd,ol,ul,li,fieldset,form,label,legend,table,caption,tbody,tfoot,thead,tr,th,td,article,aside,canvas,details,embed,figure,figcaption,footer,header,hgroup,menu,nav,output,ruby,section,summary,time,mark,audio,video?{
  67. ????margin:?0;
  68. ????padding:?0;
  69. ????border:?0;
  70. ????font-size:?100%;
  71. ????font:?inherit;
  72. ????vertical-align:?baseline
  73. }
  74. body?{
  75. ????background:?#3498db;
  76. }
  77. #loader-container?{
  78. ????width:?188px;
  79. ????height:?188px;
  80. ????color:?white;
  81. ????margin:?0?auto;
  82. ????position:?absolute;
  83. ????top:?50%;
  84. ????left:?50%;
  85. ????margin-right:?-50%;
  86. ????transform:?translate(-50%,?-50%);
  87. ????border:?5px?solid?#3498db;
  88. ????border-radius:?50%;
  89. ????-webkit-animation:?borderScale?1s?infinite?ease-in-out;
  90. ????animation:?borderScale?1s?infinite?ease-in-out;
  91. }
  92. #loadingText?{
  93. ????font-family:?'Raleway',?sans-serif;
  94. ????font-size:?1.4em;
  95. ????position:?absolute;
  96. ????top:?50%;
  97. ????left:?50%;
  98. ????margin-right:?-50%;
  99. ????transform:?translate(-50%,?-50%);
  100. }
  101. @-webkit-keyframes?borderScale?{
  102. ????0%?{
  103. ????????border:?5px?solid?white;
  104. ????}
  105. ????50%?{
  106. ????????border:?25px?solid?#3498db;
  107. ????}
  108. ????100%?{
  109. ????????border:?5px?solid?white;
  110. ????}
  111. }
  112. @keyframes?borderScale?{
  113. ????0%?{
  114. ????????border:?5px?solid?white;
  115. ????}
  116. ????50%?{
  117. ????????border:?25px?solid?#3498db;
  118. ????}
  119. ????100%?{
  120. ????????border:?5px?solid?white;
  121. ????}
  122. }
  123. </style>
  124. </head>
  125. <body>
  126. <div?id="loader-container"><p?id="loadingText">页面加载中...</p></div>
  127. </body>
  128. </html>

然后为网站配置伪静态规则。
1.Apache伪静态规则,把下面这条规则放置在RewriteEngine On下面即可

  1. RewriteRule?^go/(.*)$?/go.php?url=$1?[L]

上面的跳转文件和伪静态规则都有了,接下来就是修改跳转函数了。依次打开主题inc文件夹下面的function文件夹下面的function.php文件找到下面的代码

  1. $content=str_replace("href=\"$val\"",?"href=\"".get_template_directory_uri()."/inc/go.php?url=$val\"?",$content);
  1. echo?"<a?href='".get_template_directory_uri()."/inc/go.php?url=$url'?rel='external?nofollow'?target='_blank'?class='url'>$author</a>";
  1. $url?=?str_replace($url,?get_template_directory_uri()."/inc/go.php?url=".$url,$url);
  1. $url?=?str_replace($url,?get_template_directory_uri()."/inc/go.php?url=".$url,$url);

按顺序依次把它们替换成下面的代码

  1. $content=str_replace("href=\"$val\"",?"href=\"".home_url()."/go/".base64_encode($val)."\"",$content);
  1. echo?"<a?href='".home_url()."/go/".base64_encode($url)."'?rel='external?nofollow'?target='_blank'?class='url'>$author</a>";
  1. $url?=?str_replace($url,?home_url()."/go/".base64_encode($url),$url);
  1. $url?=?str_replace($url,?home_url()."/go/".base64_encode($url),$url);

最终的显示效果是

你的域名/go/经过加密的目的网址

  • 我的微信
  • 这是我的微信扫一扫
  • weinxin
  • 我的微信公众号
  • 我的微信公众号扫一扫
  • weinxin
avatar

发表评论

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen: