php(檔案已創建)
| @@ -0,0 +1,293 @@ | |||
| 1 | + | <?php | |
| 2 | + | // 检查必要条件 | |
| 3 | + | if (!defined('__TYPECHO_ROOT_DIR__') || empty($_SERVER['HTTP_HOST'])) { | |
| 4 | + | http_response_code(404); | |
| 5 | + | exit; | |
| 6 | + | } | |
| 7 | + | ||
| 8 | + | // 获取 URL 参数 | |
| 9 | + | function GetQueryString($name) { | |
| 10 | + | $query = parse_url($_SERVER['REQUEST_URI'], PHP_URL_QUERY); | |
| 11 | + | parse_str($query, $params); | |
| 12 | + | return isset($params[$name]) ? urldecode($params[$name]) : null; | |
| 13 | + | } | |
| 14 | + | ||
| 15 | + | // Base64 解码函数 | |
| 16 | + | function base64Decode($input) { | |
| 17 | + | return base64_decode($input); | |
| 18 | + | } | |
| 19 | + | ||
| 20 | + | // 配置参数,可根据需要修改 | |
| 21 | + | $countdown = 10; // 倒计时秒数 | |
| 22 | + | $url_param_name = 'url'; // URL 参数名 | |
| 23 | + | $enable_base64_encode = true; // 是否启用 Base64 编码 | |
| 24 | + | $avatar = $this->options->JFavicon; // 头像链接 | |
| 25 | + | $title = $this->options->title; // 标题 | |
| 26 | + | $subtitle = '大理寺卿'; // 副标题 | |
| 27 | + | $darkmode = false; // 是否启用黑暗模式 | |
| 28 | + | ||
| 29 | + | // 获取跳转 URL | |
| 30 | + | $jump_url = GetQueryString($url_param_name); | |
| 31 | + | if ($enable_base64_encode) { | |
| 32 | + | $jump_url = base64Decode($jump_url); | |
| 33 | + | } | |
| 34 | + | ||
| 35 | + | // 检查 URL 格式 | |
| 36 | + | $UrlReg = '/^((http|https|thunder|qqdl|ed2k|Flashget|qbrowser|ftp|rtsp|mms):\/\/)/'; | |
| 37 | + | if (!$jump_url ||!preg_match($UrlReg, $jump_url)) { | |
| 38 | + | $title = '参数错误,正在返回首页...'; | |
| 39 | + | $jump_url = $_SERVER['HTTP_HOST']; | |
| 40 | + | } | |
| 41 | + | ?> | |
| 42 | + | ||
| 43 | + | <!DOCTYPE html> | |
| 44 | + | <html lang="zh"> | |
| 45 | + | <head> | |
| 46 | + | <meta http-equiv="X-UA-Compatible" content="IE=edge"> | |
| 47 | + | <meta name="viewport" content="width=device-width,initial-scale=1,user-scalable=no"> | |
| 48 | + | <meta http-equiv="Content-Type" content="text/html; charset=UTF-8"> | |
| 49 | + | <meta name="robots" content="noindex, nofollow"/> | |
| 50 | + | <title><?php echo $title; ?></title> | |
| 51 | + | <style type="text/css"> | |
| 52 | + | body { | |
| 53 | + | display: flex; | |
| 54 | + | align-items: center; | |
| 55 | + | justify-content: center; | |
| 56 | + | height: 100vh; | |
| 57 | + | margin: 0; | |
| 58 | + | font-family: Arial, sans-serif; | |
| 59 | + | overflow: hidden; | |
| 60 | + | flex-direction: column; | |
| 61 | + | } | |
| 62 | + | .avatar-placeholder, .avatar { | |
| 63 | + | width: 100px; | |
| 64 | + | height: 100px; | |
| 65 | + | border-radius: 50%; | |
| 66 | + | margin-bottom: 15px; | |
| 67 | + | display: block; | |
| 68 | + | } | |
| 69 | + | .avatar { | |
| 70 | + | display: none; | |
| 71 | + | } | |
| 72 | + | .description { | |
| 73 | + | font-size: 18px; | |
| 74 | + | } | |
| 75 | + | .subtitle { | |
| 76 | + | font-size: 12px; | |
| 77 | + | margin-bottom: 20px; | |
| 78 | + | color: #C4C4C4; | |
| 79 | + | } | |
| 80 | + | .loading { | |
| 81 | + | text-align: center; | |
| 82 | + | padding: 30px; | |
| 83 | + | border-radius: 18px; | |
| 84 | + | animation: fadein 2s; | |
| 85 | + | width: 400px; | |
| 86 | + | max-width: 90%; | |
| 87 | + | } | |
| 88 | + | @keyframes fadein { | |
| 89 | + | from { | |
| 90 | + | opacity: 0; | |
| 91 | + | } | |
| 92 | + | to { | |
| 93 | + | opacity: 1; | |
| 94 | + | } | |
| 95 | + | } | |
| 96 | + | .content { | |
| 97 | + | margin-bottom: 20px; | |
| 98 | + | } | |
| 99 | + | .url-text { | |
| 100 | + | margin-bottom: 10px; | |
| 101 | + | font-size: 16px; | |
| 102 | + | letter-spacing: 1px; | |
| 103 | + | } | |
| 104 | + | .jump-url { | |
| 105 | + | font-size: 20px; | |
| 106 | + | display: block; | |
| 107 | + | margin-top: 5px; | |
| 108 | + | margin-bottom: 25px; | |
| 109 | + | padding: 15px; | |
| 110 | + | border-radius: 8px; | |
| 111 | + | height: 25px; | |
| 112 | + | white-space: nowrap; | |
| 113 | + | overflow: hidden; | |
| 114 | + | text-overflow: ellipsis; | |
| 115 | + | } | |
| 116 | + | .countdown-text { | |
| 117 | + | margin-top: 12px; | |
| 118 | + | font-size: 12px; | |
| 119 | + | } | |
| 120 | + | .button-container { | |
| 121 | + | display: flex; | |
| 122 | + | justify-content: center; | |
| 123 | + | gap: 20%; | |
| 124 | + | margin-top: 20px; | |
| 125 | + | } | |
| 126 | + | .button { | |
| 127 | + | padding: 10px 20px; | |
| 128 | + | border-radius: 16px; | |
| 129 | + | border: none; | |
| 130 | + | cursor: pointer; | |
| 131 | + | font-size: 16px; | |
| 132 | + | width: 120px; | |
| 133 | + | height: 40px; | |
| 134 | + | } | |
| 135 | + | .cancel-button { | |
| 136 | + | color: black; | |
| 137 | + | } | |
| 138 | + | .confirm-button { | |
| 139 | + | color: white; | |
| 140 | + | } | |
| 141 | + | .progress-bar { | |
| 142 | + | width: 100%; | |
| 143 | + | border-radius: 5px; | |
| 144 | + | overflow: hidden; | |
| 145 | + | height: 10px; | |
| 146 | + | margin-top: 20px; | |
| 147 | + | } | |
| 148 | + | .progress { | |
| 149 | + | width: 100%; | |
| 150 | + | height: 100%; | |
| 151 | + | transition: width 1s; | |
| 152 | + | } | |
| 153 | + | <?php if ($darkmode): ?> | |
| 154 | + | body { | |
| 155 | + | background: linear-gradient(135deg, #364f6b, #222831); | |
| 156 | + | } | |
| 157 | + | .loading { | |
| 158 | + | background: #393e46; | |
| 159 | + | color: #EFEFEF; | |
| 160 | + | box-shadow: 0 4px 8px rgba(100, 100, 100, 0.1); | |
| 161 | + | } | |
| 162 | + | .description { | |
| 163 | + | color: #F3F3F3; | |
| 164 | + | } | |
| 165 | + | .url-text, .countdown-text { | |
| 166 | + | color: #EFEFEF; | |
| 167 | + | } | |
| 168 | + | .jump-url { | |
| 169 | + | border: 1px solid #777; | |
| 170 | + | background-color: #333; | |
| 171 | + | color: #EFEFEF; | |
| 172 | + | } | |
| 173 | + | .cancel-button { | |
| 174 | + | background-color: #872C2C; | |
| 175 | + | color: #FFF; | |
| 176 | + | } | |
| 177 | + | .confirm-button { | |
| 178 | + | background-color: #28566F; | |
| 179 | + | color: #FFF; | |
| 180 | + | } | |
| 181 | + | .progress-bar { | |
| 182 | + | background-color: #444; | |
| 183 | + | } | |
| 184 | + | .progress { | |
| 185 | + | background-color: #888; | |
| 186 | + | } | |
| 187 | + | <?php else: ?> | |
| 188 | + | body { | |
| 189 | + | background: linear-gradient(135deg, #E9E9E9, #FFFFFF); | |
| 190 | + | } | |
| 191 | + | .loading { | |
| 192 | + | background: rgba(255, 255, 255, 0.7); | |
| 193 | + | box-shadow: 0 4px 8px rgba(0, 0, 0, 0.1); | |
| 194 | + | } | |
| 195 | + | .url-text { | |
| 196 | + | color: #333; | |
| 197 | + | } | |
| 198 | + | .jump-url { | |
| 199 | + | border: 1px solid #ccc; | |
| 200 | + | background-color: #F7F9FE; | |
| 201 | + | color: #333; | |
| 202 | + | } | |
| 203 | + | .countdown-text { | |
| 204 | + | color: #515151; | |
| 205 | + | } | |
| 206 | + | .cancel-button { | |
| 207 | + | background-color: #a6e3e9; | |
| 208 | + | } | |
| 209 | + | .confirm-button { | |
| 210 | + | background-color: #3fc1c9; | |
| 211 | + | } | |
| 212 | + | .progress { | |
| 213 | + | background-color: #abedd8; | |
| 214 | + | } | |
| 215 | + | <?php endif; ?> | |
| 216 | + | </style> | |
| 217 | + | <script type="text/javascript"> | |
| 218 | + | const host = window.location.host; | |
| 219 | + | let countdown = <?php echo $countdown; ?>; | |
| 220 | + | let jump_url = '<?php echo $jump_url; ?>'; | |
| 221 | + | let progressElement; | |
| 222 | + | let countdownElement; | |
| 223 | + | let countdownTextElement; | |
| 224 | + | let jumpUrlElement; | |
| 225 | + | ||
| 226 | + | function updateCountdown() { | |
| 227 | + | if (countdown < 0) { | |
| 228 | + | countdownTextElement.textContent = "💡自行点击跳转,请注意您的账号和财产安全"; | |
| 229 | + | return; | |
| 230 | + | } | |
| 231 | + | countdownElement.textContent = countdown; | |
| 232 | + | progressElement.style.width = (countdown / <?php echo $countdown; ?> * 100) + '%'; | |
| 233 | + | if (countdown === 0) { | |
| 234 | + | jump(); | |
| 235 | + | } else { | |
| 236 | + | countdown--; | |
| 237 | + | setTimeout(updateCountdown, 1000); | |
| 238 | + | } | |
| 239 | + | } | |
| 240 | + | ||
| 241 | + | function jump() { | |
| 242 | + | location.href = jump_url; | |
| 243 | + | } | |
| 244 | + | ||
| 245 | + | function closeWindow() { | |
| 246 | + | window.opener = null; | |
| 247 | + | window.close(); | |
| 248 | + | } | |
| 249 | + | ||
| 250 | + | function loadAvatar() { | |
| 251 | + | const avatarImg = document.querySelector('.avatar'); | |
| 252 | + | const placeholder = document.querySelector('.avatar-placeholder'); | |
| 253 | + | const img = new Image(); | |
| 254 | + | img.src = '<?php echo $avatar; ?>'; | |
| 255 | + | img.onload = function () { | |
| 256 | + | avatarImg.src = img.src; | |
| 257 | + | avatarImg.style.display = 'block'; | |
| 258 | + | placeholder.style.display = 'none'; | |
| 259 | + | } | |
| 260 | + | } | |
| 261 | + | ||
| 262 | + | window.addEventListener('load', function () { | |
| 263 | + | loadAvatar(); | |
| 264 | + | progressElement = document.getElementById('progress'); | |
| 265 | + | countdownElement = document.getElementById('countdown'); | |
| 266 | + | countdownTextElement = document.querySelector('.countdown-text'); | |
| 267 | + | jumpUrlElement = document.getElementById('jump-url'); | |
| 268 | + | jumpUrlElement.textContent = jump_url; | |
| 269 | + | updateCountdown(); | |
| 270 | + | }); | |
| 271 | + | </script> | |
| 272 | + | </head> | |
| 273 | + | <body> | |
| 274 | + | <div class="avatar-placeholder"></div> | |
| 275 | + | <img src="" alt="头像" class="avatar"> | |
| 276 | + | <div class="description"><?php echo $title; ?></div> | |
| 277 | + | <div class="subtitle"><?php echo $subtitle; ?></div> | |
| 278 | + | <div class="loading"> | |
| 279 | + | <div class="content"> | |
| 280 | + | <div class="url-text">您即将离开本站,跳转到:</div> | |
| 281 | + | <div class="jump-url" id="jump-url"></div> | |
| 282 | + | </div> | |
| 283 | + | <div class="countdown-text">⚡将在<span id="countdown"></span>秒后跳转,请自行确认链接安全性</div> | |
| 284 | + | <div class="progress-bar"> | |
| 285 | + | <div class="progress" id="progress"></div> | |
| 286 | + | </div> | |
| 287 | + | <div class="button-container"> | |
| 288 | + | <button class="button cancel-button" onclick="closeWindow()">取消跳转</button> | |
| 289 | + | <button class="button confirm-button" onclick="jump()">立即跳转</button> | |
| 290 | + | </div> | |
| 291 | + | </div> | |
| 292 | + | </body> | |
| 293 | + | </html> | |
上一頁
下一頁