是最新版带nonce令牌后的美化,大家看看有没有问题
使用方法:直接复制粘贴覆盖原有的/www/wwwroot/你的网站/wp-content/themes/zibll/go.php
记得先备份原先的
<?php
/*
* @Author : Qinver
* @Url : zibll.com
* @Date : 2020-09-29
* @LastEditTime : 2025-10-06
* @Project : Zibll子比主题 (样式增强版)
* @Description : WordPress外链跳转页(保留原安全逻辑 + 新视觉样式)
*/
//修改处,基本全修改了,主要是body和style
if (
strlen($_SERVER['REQUEST_URI']) > 384 ||
strpos($_SERVER['REQUEST_URI'], 'eval(') ||
strpos($_SERVER['REQUEST_URI'], 'base64')
) {
@header('HTTP/1.1 414 Request-URI Too Long');
@header('Status: 414 Request-URI Too Long');
@header('Connection: Close');
@exit;
}
@session_start();
$t_url = !empty($_SESSION['GOLINK']) ? $_SESSION['GOLINK'] : preg_replace('/^url=(.*)$/i', '$1', $_SERVER['QUERY_STRING']);
// 数据处理
if (!empty($t_url)) {
// 判断是否为base64加密
if ($t_url == base64_encode(base64_decode($t_url))) {
$t_url = base64_decode($t_url);
}
// 防止xss
// $t_url = htmlspecialchars($t_url, ENT_QUOTES, 'UTF-8');
// $t_url = str_replace(array("'", '"'), array(''', '"'), $t_url);
// $t_url = str_replace(array("\r", "\n", "\t", "\x0B", "\x0C", "\x0D"), '', $t_url);
//防止xss
$t_url = htmlspecialchars($t_url, ENT_QUOTES, 'UTF-8');
$t_url = str_replace(array("'", '"'), array(''', '"'), $t_url);
$t_url = str_replace(array("\r", "\n"), array('
', '
'), $t_url);
$t_url = str_replace(array("\t"), array(' '), $t_url);
$t_url = str_replace(array("\x0B"), array(''), $t_url);
$t_url = str_replace(array("\x0C"), array(''), $t_url);
$t_url = str_replace(array("\x0D"), array('
'), $t_url);
// 校验协议
preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i', $t_url, $matches);
if ($matches) {
$url = $t_url;
$title = '页面加载中,请稍候...';
} else {
preg_match('/\./i', $t_url, $matche);
if ($matche) {
$url = 'http://' . $t_url;
$title = '页面加载中,请稍候...';
} else {
$url = 'http://' . $_SERVER['HTTP_HOST'];
$title = '参数错误,正在返回首页...';
}
}
} else {
$title = '参数缺失,正在返回首页...';
$url = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
}
// 防止外站盗链
if (function_exists('zib_get_url_top_host')) {
$host = zib_get_url_top_host($_SERVER['HTTP_HOST']);
$referer = isset($_SERVER['HTTP_REFERER']) ? $_SERVER['HTTP_REFERER'] : '';
if (!empty($referer) && !preg_match('/' . preg_quote($host, '/') . '/i', $referer)) {
$url = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$title = '非法请求,正在返回首页...';
}
}
// 验证nonce(防伪造)
if (function_exists('_pz') && _pz('go_link_nonce_s')) {
$nonce = isset($_GET['nonce']) ? $_GET['nonce'] : '';
if (empty($nonce) || !wp_verify_nonce($nonce, 'go_link_nonce')) {
$url = $_SERVER['REQUEST_SCHEME'] . '://' . $_SERVER['HTTP_HOST'];
$title = '非法请求,正在返回首页...';
}
}
$url = str_replace(['&amp;', '&'], '&', $url);
?>
<html>
<head>
<meta charset="UTF-8">
<meta name="robots" content="noindex, nofollow" />
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<?php if (function_exists('zib_head_favicon')) zib_head_favicon(); ?>
<noscript><meta http-equiv="refresh" content="1;url='<?php echo $url; ?>';"></noscript>
<title><?php echo $title; ?></title>
<link rel="stylesheet" href="//cdn.staticfile.org/font-awesome/4.7.0/css/font-awesome.min.css">
<style>
body,html{padding:0;margin:0}
body{background:#f5f6f7;font-family:-apple-system,BlinkMacSystemFont,"Segoe UI",Roboto,Oxygen-Sans,Ubuntu,Cantarell,"Helvetica Neue",sans-serif}
a{cursor:pointer;text-decoration:none;word-wrap:break-word;word-break:break-all}
.wiiuii-go-main{display:flex;width:100%;height:100vh;justify-content:center;align-items:center}
.wiiuii-go-container{position:relative;max-width:28em;background:#fff;margin:10px;padding:1.5em;border-radius:8px;box-shadow:0 0 20px rgba(0,0,0,.08)}
.wiiuii-go-content a{color:#036af4}
.wiiuii-go-content a:hover{color:#e91e63}
.wiiuii-go-logo{text-align:center;width:auto;height:65px;margin-bottom:10px}
.wiiuii-go-logo img{max-width:100%;height:100%}
.wiiuii-go-msg{text-align:center;padding:10px 5px;font-weight:700;color:rgba(255,0,0,0.85);background:rgba(255,0,0,0.1);border-radius:5px;margin-bottom:10px}
.wiiuii-go-button-item{text-align:right;margin-top:10px}
.wiiuii-go-button{display:inline-block;border-radius:99px;padding:10px 15px;background:rgba(116,116,116,.1);transition:all .3s;margin-left:5px}
.wiiuii-go-button a{font-weight:700;font-size:14px;color:#333}
.wiiuii-go-button:hover{background:rgba(116,116,116,.2)}
.wiiuii-goid-item{position:absolute;top:10px;left:10px;border-radius:4px;overflow:hidden;background:#ffd07c;font-size:13px}
.wiiuii-goid-title{padding:0 4px;background:#ffa400;color:#fff}
.wiiuii-goid-text{padding:0 5px;color:#333}
hr{border:0;height:1px;background:#eee;margin:15px 0}
</style>
</head>
<body>
<div class="wiiuii-go-main">
<div class="wiiuii-go-container">
<div class="wiiuii-goid-item">
<b class="wiiuii-goid-title">GID</b>
<span class="wiiuii-goid-text"><?php echo substr(md5($url), 0, 8); ?></span>
</div>
<div class="wiiuii-go-logo">
<?php if (function_exists('zib_get_adaptive_theme_img')) echo zib_get_adaptive_theme_img(_pz('logo_src'), _pz('logo_src_dark')); ?>
</div>
<div class="wiiuii-go-content">
<div class="wiiuii-go-msg">
<i class="fa fa-exclamation-triangle"></i>
您即将离开本站,请注意您的账号和财产安全。
</div>
<p>访问链接:<a onclick="location.replace('<?php echo $url; ?>')" title="<?php echo $url; ?>"><?php echo $url; ?></a></p>
</div>
<hr>
<div class="wiiuii-go-button-item">
<div class="wiiuii-go-button">
<a onclick="location.replace('//<?php echo $_SERVER['HTTP_HOST']; ?>')">返回首页</a>
</div>
<div class="wiiuii-go-button">
<a onclick="location.replace('<?php echo $url; ?>')">继续访问 <span style="font-weight:bold;color:red;" id="countdown"></span> 秒</a>
</div>
</div>
</div>
</div>
<script>
function link_jump() {
location.href = "<?php echo $url; ?>";
}
// 倒计时跳转
function startCountdown(duration, display) {
var timer = duration;
var countdown = setInterval(function () {
display.textContent = timer;
if (--timer < 0) {
clearInterval(countdown);
link_jump();
}
}, 1000);
}
window.onload = function () {
var timeLeft = 5;
var countdownDisplay = document.getElementById('countdown');
startCountdown(timeLeft, countdownDisplay);
};
//延时15S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
setTimeout(function() {
window.opener = null;
window.close();
}, 15000);
</script>
</body>
</html>