Advertisement
ZimaKunta

hỏi đáp php

Sep 17th, 2022
118
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 3.98 KB | None | 0 0
  1. <?php
  2. /*
  3. Template Name: Chuyển hướng
  4. */
  5.  
  6. // get the redirection url from GET variable
  7. $redirect_to = !empty($_GET['url'])
  8. ? trim(strip_tags(stripslashes($_GET['url'])))
  9. : '';
  10.  
  11. $wait_time = 15000; // thời gian tự động chuyển hướng (tính bằng millisecond - ở đây là 30000 ml = 30s).
  12. $wait_seconds = $wait_time / 1000;
  13.  
  14. add_action('wp_head', 'redirect_to_no_index', 99);
  15. function redirect_to_no_index()
  16. {
  17. ?>
  18. <!-- tắt index trang này -->
  19. <meta name="robots" content="noindex, follow">
  20.  
  21. <?php
  22. }
  23.  
  24. add_action('wp_head', 'redirect_to_external_link');
  25.  
  26. function redirect_to_external_link()
  27. {
  28. global $redirect_to, $wait_seconds, $wait_time;
  29.  
  30. if (empty($redirect_to) || empty($wait_time)) {
  31. return;
  32. }
  33. ?>
  34.  
  35. <script>var redirect = window.setTimeout(function(){window.location.href='<?php esc_html_e($redirect_to); ?>'},<?php echo $wait_time; ?>);</script>
  36. <noscript><meta http-equiv="refresh" content="<?php echo $wait_seconds; ?>;url=<?php esc_attr_e($redirect_to); ?>">></noscript>
  37.  
  38. <!--
  39. <script>var redirect = window.setTimeout(function(){window.open("/index.php/2022/08/23/chao-moi-nguoi/"), "_blank"; myWindow.focus();},<?php echo $wait_time; ?>);</script>
  40. <noscript><meta http-equiv="refresh" content="<?php echo $wait_seconds; ?>;url=<?php esc_attr_e($redirect_to); ?>">></noscript>
  41. -->
  42. <?php
  43. }
  44.  
  45. get_header(); //hiện thị header
  46. ?>
  47. <style>
  48. .sora-ads-here {
  49. display: block;
  50. background-color: #eee;
  51. text-align: center;
  52. font-size: 13px;
  53. color: #aaaaaa;
  54. font-weight: 400;
  55. font-style: italic;
  56. line-height: 90px;
  57. border: 1px solid #ccc;
  58. }
  59. </style>
  60. <div><p style="padding-bottom: 1em;">
  61. &nbsp;
  62. </p></div>
  63. <div id="redirect-page-content" style="width: 100%; background:#fff; height: 50%; margin: 0px 0px 0px 0px; text-align: center; font-size: 18px;">
  64. <div class="redirect-message">
  65. <?php if (!empty($redirect_to)) {
  66. //echo '<p style="font-size: 95%;margin: 8px !important; color: #191919;">BẠN ĐANG ĐƯỢC CHUYỂN ĐẾN TRANG TẢI FILE</p>';
  67. //printf(__('<strong style="margin: 8px !important;">%s</strong>'),esc_html($redirect_to));
  68. ?>
  69. <p>&nbsp;</p>
  70. <p style="font-size: 100%;margin: 8px 0px 15px 0px !important;color: #f50c0c;"><strong>TỰ ĐỘNG CHUYỂN ĐẾN TRANG TẢI FILE SAU <span style="color: #2fad16" id="timer"></span> GIÂY </strong></p>
  71.  
  72. <p style="font-size: 90%;margin: 8px 0px 15px 0px !important;color: #FFFFFF"> . </p> </p>
  73. <p></p>
  74. </div>
  75.  
  76. <?php
  77. } else {
  78. _e('Link chuyển hướng bị lỗi');
  79. }
  80. ?>
  81. </div>
  82. </div>
  83. <script>
  84. document.getElementById('timer').innerHTML = <?php echo $wait_seconds;?>;
  85. var timer = <?php echo $wait_seconds;?>;
  86. var interval = setInterval(function() {
  87. var seconds = timer;
  88. if (seconds > 0) {
  89. --seconds;
  90. document.getElementById('timer').innerHTML = seconds + "";
  91. timer = seconds;
  92. }
  93. else {
  94.  
  95. }
  96.  
  97. }, 1000);
  98. </script>
  99.  
  100. <?php
  101. get_footer(); //hiện thị footer
  102. ?>
  103. <style>
  104. .sora-ads-here {
  105. display: block;
  106. background-color: #eee;
  107. text-align: center;
  108. font-size: 13px;
  109. color: #aaaaaa;
  110. font-weight: 400;
  111. font-style: italic;
  112. line-height: 90px;
  113. border: 1px solid #ccc;
  114. #chuyenngay{width: 60%; margin: 7px;background: #FF9966; border: 1px solid #00cc00; color: #fff; cursor: pointer; font-size: 13px ; font-weight: bold ; padding: 7px 15px;text-decoration: none;text-transform: uppercase;text-shadow: none;}
  115. #chuyenngay:hover, #dongchuyen:hover{background: #555; border: 1px solid #555}
  116. #chuyenngay2{width: 60%; margin: 7px;background: ##00DD00; border: 1px solid #00cc00; color: #fff; cursor: pointer; font-size: 13px ; font-weight: bold ; padding: 7px 15px;text-decoration: none;text-transform: uppercase;text-shadow: none;}
  117. #chuyenngay2:hover, #dongchuyen:hover{background: #555; border: 1px solid #555}
  118. }
  119. </style>
  120. </div></div>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement