Files
SEONexus/code/app/home/view/public/error.html
make cbcb03af5b 1.SiteContext.php 增加 checkCnzzCookie 检测 是否有cnzz的cooke,没有则是 爬虫行为,需要拦截
2.404页面增加统计cnzz统计代码
    3.允许用户3次无cooke 访问, 3次后无cooke 则返回404
2025-08-18 21:15:04 +08:00

114 lines
3.2 KiB
HTML

<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>404 - 页面未找到</title>
<style>
body {
font-family: Arial, sans-serif;
text-align: center;
background-color: #f2f2f2;
margin: 0;
padding: 0;
display: flex;
justify-content: center;
align-items: center;
height: 100vh;
color: #333;
}
.container {
max-width: 500px;
padding: 20px;
background: #fff;
box-shadow: 0 0 10px rgba(0, 0, 0, 0.1);
border-radius: 8px;
}
h1 {
font-size: 48px;
margin-bottom: 20px;
color: #e74c3c;
}
p {
font-size: 16px;
margin-bottom: 10px;
}
a {
color: #3498db;
text-decoration: none;
}
a:hover {
text-decoration: underline;
}
.countdown {
font-weight: bold;
color: #e74c3c;
}
</style>
<script>
// let countdown = 5;
// function startCountdown() {
// const countdownElement = document.getElementById('countdown');
// const interval = setInterval(() => {
// countdown--;
// countdownElement.textContent = countdown;
// if (countdown <= 0) {
// clearInterval(interval);
// window.history.back();
// }
// }, 1000);
// }
let countdown = 5;
function startCountdown() {
const countdownElement = document.getElementById('countdown');
const interval = setInterval(() => {
countdown--;
countdownElement.textContent = countdown;
if (countdown <= 0) {
clearInterval(interval);
// Check if there is a previous page in history
if (document.referrer) {
window.history.back();
} else {
window.location.href = '/'; // Redirect to home if no previous page
}
}
}, 1000);
}
// Start the countdown when the script loads
window.onload = startCountdown;
</script>
</head>
<body onload="startCountdown()">
<div class="container">
<h1>{$strErrCode}</h1>
<p>{$strErrMsg}</p>
<p>5 秒后将自动返回上一页。</p>
<p>倒计时:<span id="countdown" class="countdown">5</span></p>
<p>或者 <a href="/">点击这里返回首页</a></p>
</div>
{site:cfg code="PUBLIC_TONGJI_CODE" encode="false"/}
<script>
var _czc = _czc || [];
(function () {
var um = document.createElement("script");
um.src = "https://s9.cnzz.com/z.js?id=1281427615&async=1";
var s = document.getElementsByTagName("script")[0];
s.parentNode.insertBefore(um, s);
})();
</script>
</body>
</html>