子比主题美化go外链跳转美化代码

温馨提示:本文最后更新于2023-12-27 10:47:12,某些文章具有时效性,若有错误或已失效,请在下方留言或联系站长

效果图:

不会自动跳转,需勾选后点击跳转

图片[1]-子比主题美化go外链跳转美化代码-胖大海博客资源网

无需操作自动跳转,默认3秒可自行修改

图片[2]-子比主题美化go外链跳转美化代码-胖大海博客资源网

代码教程

一、不会自动跳转的

1、复制代码,替换/wp-content/themes/zibll/go.php文件全部内容

2、搜索logo链接替换成自己的

<?php
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;
}
//通过QUERY_STRING取得完整的传入数据,然后取得url=之后的所有值,兼容性更好
@session_start();
$t_url = !empty($_SESSION['GOLINK']) ? $_SESSION['GOLINK'] : preg_replace('/^url=(.*)$/i', '$1', $_SERVER["QUERY_STRING"]);
//数据处理
if (!empty($t_url)) {
    //判断取值是否加密
    if ($t_url == base64_encode(base64_decode($t_url))) {
        $t_url = base64_decode($t_url);
    }
    //防止xss
    $t_url = htmlspecialchars($t_url);
    //对取值进行网址校验和判断
    preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i', $t_url, $matches);
    $yelan_title = get_bloginfo('name');
    $title = $yelan_title . ' - 外链安全跳转提醒';
    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   = 'http://' . $_SERVER['HTTP_HOST'];
}
$url = str_replace('&', '&', $url);
?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="robots" content="noindex, nofollow" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <?php echo "<link rel='apple-touch-icon-precomposed icon' href='" . _pz('iconpng') . "' type='image/x-icon'/>"; ?>
    <noscript>
        <meta http-equiv="refresh" content="1;url='<?php echo $url; ?>';">
    </noscript>
    <script>
        function link_jump() {
            //禁止其他网站使用我们的跳转页面
            var MyHOST = new RegExp("<?php echo $_SERVER['HTTP_HOST']; ?>");
            if (!MyHOST.test(document.referrer)) {
                location.href = "//" + MyHOST;
            }
            location.href = "<?php echo $url; ?>";
        }
        //延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
        setTimeout(function() {
            window.opener = null;
            window.close();
        }, 50000);
    </script>
    <title>
        <?php echo $title; ?>
    </title>
<style>
			html,body{background:#F3F4F5;font-family: PingFang SC,Hiragino Sans GB,Arial,Microsoft YaHei,Verdana,Roboto,Noto,Helvetica Neue,sans-serif;padding:0;margin:0;}
			a{text-decoration:none;}
			.urlArea			{ padding-top:50px;width:450px;margin:auto;word-break: break-all; }
			.urlArea .logo img	{ display: block;margin:auto;margin-bottom: 16px; max-width:350px; }
			.urlArea .main		{ background:#fff;padding:24px;border-radius: 12px;border: 1px solid #E1E1E1; }
			.urlArea .flex		{ display:flex;align-items:center; }
			.urlArea .btn		{ display:flex;justify-content:flex-end;align-items: center; }
			.urlArea .tip		{ background:#e8eefa;padding:12px;margin-bottom:16px;border-radius:4px; }
			.urlArea .urlColor	{ color:red; }
			.urlArea .urlBox	{ font-size: 14px;color: #222226;line-height: 24px;margin-bottom:24px; }
			.urlArea .ico		{ width:24px;height:24px; }
			.urlArea .goBtn		{ white-space: nowrap;font-size: 14px;background-color: #408ffa;color:#ffffff;border: 1px solid #408ffa;display:inline-block;box-sizing: border-box;padding:6px 18px;border-radius: 18px;margin-left:8px; }
			.urlArea .icoTxt	{ font-size: 16px;font-weight: 600;color: #222226;line-height: 22px;margin-left:12px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap; }
			@media (max-width: 600px){
				.urlArea	{ padding-top:90px;width:94%; }
			}
			</style>
		</head>
		<body>
			<div class="urlArea">
				<div class="logo"><img src="logo链接"></div><!--logo链接替换位置-->
				<div class="main">
					<div class="flex tip">
						<img class="ico" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADWUlEQVRoQ+2YvWsUQRiH33fmOMQiRQor7RQSweB9KAQEg1iYKFaZnJJ/wcTOMhLs7Ez8FwLebikasTGCoJDcHSoYQbHRyiKFhajczCu3SS73sbfzsXNJDnLV3s4y83vm3X12dhAG/IcDnh+OAHpVkITISvg2DYyQjwyVcXGt3o9q960CdZELAWC6ERoRn/CgentgAGimOCVJPmsNzJFfx2DjuW8I7xWg+xMZ9enXRwIaaQ2LgJ/Z2aFzvm8l7wBypjBPpB7FzTQiu8uDypLPKngFIDE+rODPFwIYjgUA2GJw7AyGb7d8QXgFkCK/TEB3ksIh4GMeVucOHQCV8qNKwQcCymgA6ozBGJarmz4gvFWgLvKrAHTNLBS+yITVSbNrk6/yAhCnTV04X1pNDdBLmzoAX1pNDZCkTS2EB62mAtBpUwvgQaupAEy0qYdIp1VnAFNtGgCk0qozgJ02tRjOWnUCoFJxUiqZuLJEgB+AbCWKTmqWAE4mYXDGp7C8sapD7Wy3BjDVJke8iUH1aZS/lL8hFUXHvX6uWrUGMNUmByxiWK1sAxTyUqnoOBHCQatWADbadAJw0KoVgJwpLBEpo5WkC0CjOohsmQeVeV21dtuNAWy16QwAaKVVYwBbbboCbM+s+WrVCMBEm50lTwcAYKpVLYCpNrsALDXa7XezTQAtgKk2Y14wVi+yuIfWZBMgEcBGm6bWsLkODbSaCGCjTZtgNtfqtNoTwFabMffwb0DYWQvBLAEdtwm+5/lkrfYEsNVmazgElIzxcSyvr0dLiVu5opL4joC4C0SSVmMBXLTZBoDwnge1863npMjVCKDtnA1ML612Abhqs70C8JPB6VMYhv+iCgiRVfD1OwGcsAndPim4yUaHxjr3VrsAZCk3RwpS718i4gpjdK8RQil8SESzruGbzwODeV6uLXdM1t7fg9amDjBOq20VOAza1EJ0rFabAGm1qRvYVzt2rFabAHWRa3zjetmv9BU2oZ/VTFibarRHACQuXJZQX9uHgb0NwZFdwaDyKgKQorBAoBa99b4PHSHCAx7UFnYqULikUL0mArYPY6ceInrTA05gWHmz9xCL4kWF6ioAZFOP0NcO8C8jerm746H9HuhrFg+dHwF4mMRUXQx8Bf4DeBHHQHvQneAAAAAASUVORK5CYII=" alt="温馨提醒">
						<div class="icoTxt">请注意您的账号和财产安全</div>
					</div>
					<div class="urlBox">
						<span>
							<div style="font-weight:bold;padding-bottom:8px;">即将跳转到外部网站<span style="color:#c8c8c8;font-weight:bold;">,安全性未知,是否继续?</span></div>
							您将要访问的链接不属于本网站,请注意您的账号和财产安全。<br />
							前往:<a class="urlColor"><?php echo $url; ?></a>
						</span>
					</div>
					<div class="btn">
						<label style="color:red;font-size:12px;"><input type="checkbox" id="isOk" value="1" />本人已知晓风险,本人自愿访问,与本网站无关。</label>
						<a id="goBtn" class="goBtn" href="#" target="_self" onclick="return CheckGoUrl()">继续访问</a>
						<script language="javascript" type="text/javascript">
						var goUrl = decodeURIComponent("<?php echo $url; ?>");
						document.getElementById("goBtn").href = goUrl;
						function CheckGoUrl(){
							if (document.getElementById("isOk").checked){
								document.location.href = goUrl;
								return true;
							}else{
								alert("请先打钩左侧【本人已知晓风险】项!");	// ,再点击【继续访问】
								return false;
							}
						}
						</script>
<script type="text/javascript">
function GetQueryString(name){
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
var myurl=GetQueryString("f");
if(myurl !=null && myurl.toString().length>1){
  var tg='?f='+GetQueryString("f");
} else {
var tg='';
}
$(function(){
 $("#CopyURL").val('<?php echo $url; ?>'+tg);
	var clipboard = new Clipboard('#btnCopy');
	clipboard.on('success', function(e) {   
		setTimeout(function() {
			alert('复制成功,快去浏览器中粘贴访问吧!')
		}, 200)
	});
	 clipboard.on('error', function(e) {
		setTimeout(function() {
			prompt("复制失败了,请长按全选输入框复制吧~", '<?php echo $url; ?>'+tg)
		}, 200)
	});
});	
function loading() {
	var num = 0;
	var kg = true;
	setInterval(function() {
		if (kg) {
			if (num == 100) {
				window.location.href = "<?php echo $url; ?>" + tg;
				kg = false;
				return false;
			}
			$('.load_number').html(num);
			num++;
		}
	}, 30)
	$('.loading').css('width', '100%')
};
$(function(){
	var u = navigator.userAgent;
	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
	if (isAndroid) {
		$("#ico").addClass("and")
	} else {
		$("#ico").addClass("ios")
	}
	var ua = navigator.userAgent.toLowerCase();
    if(ua.indexOf(' qq')>-1 && ua.indexOf('mqqbrowser') <0){
	   $('.none').css({'opacity':'1'});
	   $('.img_bg,.load').hide();
	    return;
	} else if (ua.match(/MicroMessenger/i) == 'micromessenger') {
	    $('.none').css({'opacity':'1'});
		$('.img_bg,.load').hide();
        return;
    } else {	
		loading();
		return false
	}
});
</script>
<div style="display:none"></div>
</body>

二、自动跳转的

1、复制代码,替换/wp-content/themes/zibll/go.php文件全部内容

2、搜索logo链接替换成自己的,搜索3000可修改延迟跳转时间

<?php
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;
}
//通过QUERY_STRING取得完整的传入数据,然后取得url=之后的所有值,兼容性更好
@session_start();
$t_url = !empty($_SESSION['GOLINK']) ? $_SESSION['GOLINK'] : preg_replace('/^url=(.*)$/i', '$1', $_SERVER["QUERY_STRING"]);
//数据处理
if (!empty($t_url)) {
    //判断取值是否加密
    if ($t_url == base64_encode(base64_decode($t_url))) {
        $t_url = base64_decode($t_url);
    }
    //防止xss
    $t_url = htmlspecialchars($t_url);
    //对取值进行网址校验和判断
    preg_match('/^(http|https|thunder|qqdl|ed2k|Flashget|qbrowser):\/\//i', $t_url, $matches);
    $yelan_title = get_bloginfo('name');
    $title = $yelan_title . ' - 外链安全跳转提醒';
    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   = 'http://' . $_SERVER['HTTP_HOST'];
}
$url = str_replace('&', '&', $url);
?>
<html>
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
    <meta name="robots" content="noindex, nofollow" />
    <meta name="viewport" content="width=device-width, initial-scale=1.0, user-scalable=0, minimum-scale=1.0, maximum-scale=1.0">
    <?php echo "<link rel='apple-touch-icon-precomposed icon' href='" . _pz('iconpng') . "' type='image/x-icon'/>"; ?>
    <noscript>
        <meta http-equiv="refresh" content="1;url='<?php echo $url; ?>';">
    </noscript>
    <script>
        function link_jump() {
            //禁止其他网站使用我们的跳转页面
            var MyHOST = new RegExp("<?php echo $_SERVER['HTTP_HOST']; ?>");
            if (!MyHOST.test(document.referrer)) {
                location.href = "//" + MyHOST;
            }
            location.href = "<?php echo $url; ?>";
        }
        //延时3S跳转,可自行修改延时时间
        setTimeout(link_jump, 3000);
        //延时50S关闭跳转页面,用于文件下载后不会关闭跳转页的问题
        setTimeout(function() {
            window.opener = null;
            window.close();
        }, 50000);
    </script>
    <title>
        <?php echo $title; ?>
    </title>
<style>
			html,body{background:#F3F4F5;font-family: PingFang SC,Hiragino Sans GB,Arial,Microsoft YaHei,Verdana,Roboto,Noto,Helvetica Neue,sans-serif;padding:0;margin:0;}
			a{text-decoration:none;}
			.urlArea			{ padding-top:50px;width:450px;margin:auto;word-break: break-all; }
			.urlArea .logo img	{ display: block;margin:auto;margin-bottom: 16px; max-width:350px; }
			.urlArea .main		{ background:#fff;padding:24px;border-radius: 12px;border: 1px solid #E1E1E1; }
			.urlArea .flex		{ display:flex;align-items:center; }
			.urlArea .btn		{ display:flex;justify-content:flex-end;align-items: center; }
			.urlArea .tip		{ background:#e8eefa;padding:12px;margin-bottom:16px;border-radius:4px; }
			.urlArea .urlColor	{ color:red; }
			.urlArea .urlBox	{ font-size: 14px;color: #222226;line-height: 24px;margin-bottom:24px; }
			.urlArea .ico		{ width:24px;height:24px; }
			.urlArea .goBtn		{ white-space: nowrap;font-size: 14px;background-color: #408ffa;color:#ffffff;border: 1px solid #408ffa;display:inline-block;box-sizing: border-box;padding:6px 18px;border-radius: 18px;margin-left:8px; }
			.urlArea .icoTxt	{ font-size: 16px;font-weight: 600;color: #222226;line-height: 22px;margin-left:12px;overflow: hidden;text-overflow:ellipsis;white-space: nowrap; }
			@media (max-width: 600px){
				.urlArea	{ padding-top:90px;width:94%; }
			}
			</style>
		</head>
		<body>
			<div class="urlArea">
				<div class="logo"><img src="logo链接"></div>  <!--logo链接替换位置-->
				<div class="main">
					<div class="flex tip">
						<img class="ico" src="data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAADAAAAAwCAYAAABXAvmHAAADWUlEQVRoQ+2YvWsUQRiH33fmOMQiRQor7RQSweB9KAQEg1iYKFaZnJJ/wcTOMhLs7Ez8FwLebikasTGCoJDcHSoYQbHRyiKFhajczCu3SS73sbfzsXNJDnLV3s4y83vm3X12dhAG/IcDnh+OAHpVkITISvg2DYyQjwyVcXGt3o9q960CdZELAWC6ERoRn/CgentgAGimOCVJPmsNzJFfx2DjuW8I7xWg+xMZ9enXRwIaaQ2LgJ/Z2aFzvm8l7wBypjBPpB7FzTQiu8uDypLPKngFIDE+rODPFwIYjgUA2GJw7AyGb7d8QXgFkCK/TEB3ksIh4GMeVucOHQCV8qNKwQcCymgA6ozBGJarmz4gvFWgLvKrAHTNLBS+yITVSbNrk6/yAhCnTV04X1pNDdBLmzoAX1pNDZCkTS2EB62mAtBpUwvgQaupAEy0qYdIp1VnAFNtGgCk0qozgJ02tRjOWnUCoFJxUiqZuLJEgB+AbCWKTmqWAE4mYXDGp7C8sapD7Wy3BjDVJke8iUH1aZS/lL8hFUXHvX6uWrUGMNUmByxiWK1sAxTyUqnoOBHCQatWADbadAJw0KoVgJwpLBEpo5WkC0CjOohsmQeVeV21dtuNAWy16QwAaKVVYwBbbboCbM+s+WrVCMBEm50lTwcAYKpVLYCpNrsALDXa7XezTQAtgKk2Y14wVi+yuIfWZBMgEcBGm6bWsLkODbSaCGCjTZtgNtfqtNoTwFabMffwb0DYWQvBLAEdtwm+5/lkrfYEsNVmazgElIzxcSyvr0dLiVu5opL4joC4C0SSVmMBXLTZBoDwnge1863npMjVCKDtnA1ML612Abhqs70C8JPB6VMYhv+iCgiRVfD1OwGcsAndPim4yUaHxjr3VrsAZCk3RwpS718i4gpjdK8RQil8SESzruGbzwODeV6uLXdM1t7fg9amDjBOq20VOAza1EJ0rFabAGm1qRvYVzt2rFabAHWRa3zjetmv9BU2oZ/VTFibarRHACQuXJZQX9uHgb0NwZFdwaDyKgKQorBAoBa99b4PHSHCAx7UFnYqULikUL0mArYPY6ceInrTA05gWHmz9xCL4kWF6ioAZFOP0NcO8C8jerm746H9HuhrFg+dHwF4mMRUXQx8Bf4DeBHHQHvQneAAAAAASUVORK5CYII=" alt="温馨提醒">
						<div class="icoTxt">请注意您的账号和财产安全</div>
					</div>
					<div class="urlBox">
						<span>
							<div style="font-weight:bold;padding-bottom:8px;">即将跳转到外部网站<span style="color:#c8c8c8;font-weight:bold;">,安全性未知,是否继续?</span></div>
							您将要访问的链接不属于本网站,请注意您的账号和财产安全。<br />
							前往:<a class="urlColor"><?php echo $url; ?></a>
						</span>
					</div>
					<div class="btn">
						<label style="color:red;font-size:12px;">本人已知晓风险,本人自愿访问,与本网站无关。</label>
						<a id="goBtn" class="goBtn" href="#" target="_self" onclick="return CheckGoUrl()">即将自动跳转</a>
						<script language="javascript" type="text/javascript">
						var goUrl = decodeURIComponent("<?php echo $url; ?>");
						document.getElementById("goBtn").href = goUrl;
						
						}
						</script>
<script type="text/javascript">
function GetQueryString(name){
     var reg = new RegExp("(^|&)"+ name +"=([^&]*)(&|$)");
     var r = window.location.search.substr(1).match(reg);
     if(r!=null)return  unescape(r[2]); return null;
}
var myurl=GetQueryString("f");
if(myurl !=null && myurl.toString().length>1){
  var tg='?f='+GetQueryString("f");
} else {
var tg='';
}
$(function(){
 $("#CopyURL").val('<?php echo $url; ?>'+tg);
	var clipboard = new Clipboard('#btnCopy');
	clipboard.on('success', function(e) {   
		setTimeout(function() {
			alert('复制成功,快去浏览器中粘贴访问吧!')
		}, 200)
	});
	 clipboard.on('error', function(e) {
		setTimeout(function() {
			prompt("复制失败了,请长按全选输入框复制吧~", '<?php echo $url; ?>'+tg)
		}, 200)
	});
});	
function loading() {
	var num = 0;
	var kg = true;
	setInterval(function() {
		if (kg) {
			if (num == 100) {
				window.location.href = "<?php echo $url; ?>" + tg;
				kg = false;
				return false;
			}
			$('.load_number').html(num);
			num++;
		}
	}, 30)
	$('.loading').css('width', '100%')
};
$(function(){
	var u = navigator.userAgent;
	var isAndroid = u.indexOf('Android') > -1 || u.indexOf('Adr') > -1;
	if (isAndroid) {
		$("#ico").addClass("and")
	} else {
		$("#ico").addClass("ios")
	}
	var ua = navigator.userAgent.toLowerCase();
    if(ua.indexOf(' qq')>-1 && ua.indexOf('mqqbrowser') <0){
	   $('.none').css({'opacity':'1'});
	   $('.img_bg,.load').hide();
	    return;
	} else if (ua.match(/MicroMessenger/i) == 'micromessenger') {
	    $('.none').css({'opacity':'1'});
		$('.img_bg,.load').hide();
        return;
    } else {	
		loading();
		return false
	}
});
</script>
<div style="display:none"></div>
</body>
------本页内容已结束,喜欢请分享------

感谢您的来访,获取更多精彩文章请收藏本站。

------关注微信公众号:胖大海TuT------
© 版权声明
THE END
喜欢就支持一下吧
点赞62 分享
评论 抢沙发

请登录后发表评论

    暂无评论内容