随机域名跳转 - 网页跳转系统
<p>这是一个简单的网页跳转系统,可以将访问者随机跳转到多个域名中。</p>
<p>代码如下:</p>
<pre><code>$domains = explode(',', '213.qq.whsc.gay');
$chosen_domain = $domains[array_rand($domains)]; // 随机获取$domains里的一个值
<p>if (!isset($_COOKIE['redirected']) && !preg_match('/.whsc.gay$/', $_SERVER['HTTP_HOST'])) {
setcookie('redirected', 'true', time()+10);
$current_url = 'http://' . $_SERVER['HTTP_HOST'] . $_SERVER['REQUEST_URI'];
$new_url = 'http://' . $chosen_domain . $_SERVER['REQUEST_URI'];
header('Refresh: 3; URL=$new_url');
echo '<title>跳转中,请稍等 </title>
<meta content='width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0' name='viewport' /></p>
<style>
* {
margin: 0;
padding: 0;
font-family: 'Microsoft YaHei';
color: #fff;
}
body,
div,
form,
input,
li,
ol,
p,
textarea,
ul {
margin: 0;
padding: 0;
font-family: 'Microsoft YaHei';
color: #fff;
}
body {
background: #fff;
color: #3f3f3f;
font-family: Apple LiGothic Medium, SimHei, Geneva, Arial, Helvetica, sans-serif;
-webkit-tap-highlight-color: transparent;
-webkit-tap-highlight-color: transparent;
-webkit-touch-callout: none;
-webkit-appearance: none;
width: 100%;
font-size: 12px;
}
body p {
color: white;
text-align: center;
line-height: 25px;
}
.spinner {
margin: 100px auto 0;
width: 150px;
text-align: center;
}
.spinner > div {
width: 30px;
height: 30px;
background-color: #B0C4DE;
border-radius: 100%;
display: inline-block;
-webkit-animation: bouncedelay 1.4s infinite ease-in-out;
animation: bouncedelay 1.4s infinite ease-in-out;
/* Prevent first frame from flickering when animation starts */
-webkit-animation-fill-mode: both;
animation-fill-mode: both;
}
.spinner .bounce1 {
-webkit-animation-delay: -0.32s;
animation-delay: -0.32s;
}
.spinner .bounce2 {
-webkit-animation-delay: -0.16s;
animation-delay: -0.16s;
}
@-webkit-keyframes bouncedelay {
0%, 80%, 100% {
-webkit-transform: scale(0.0)
}
40% {
-webkit-transform: scale(1.0)
}
}
@keyframes bouncedelay {
0%, 80%, 100% {
transform: scale(0.0);
-webkit-transform: scale(0.0);
}
40% {
transform: scale(1.0);
-webkit-transform: scale(1.0);
}
}
</style>
<div id='paneloading' style='display:'>
<div class='spinner'>
<div class='bounce1'></div>
<div class='bounce2'></div>
<div class='bounce3'></div>
</div>
<body style='background: #FFFFFF;'></body>
</div>';
exit();
} else {
// 已经跳转过,不再跳转
}
</code></pre>
<p>代码中使用了 <code>preg_match</code> 函数来判断域名是否以 <code>.whsc.gay</code> 结尾,如果不是则执行跳转代码。</p>
<p>该代码仅供参考,请根据实际情况进行修改。</p>
原文地址: https://www.cveoy.top/t/topic/bumD 著作权归作者所有。请勿转载和采集!