<?php
if (session_status() === PHP_SESSION_NONE) {
    session_start();

    if (isset($_SESSION['id'])) {
        $id = $_SESSION['id'];
        $u_user = $_SESSION['username'];
        $extplayer = $_SESSION['extplayer'];
        $email_user = $_SESSION['email'];
        $nomor_user = $_SESSION['nomor'];
        $bank_user = $_SESSION['bank'];
        $no_rek_user = $_SESSION['no_rek'];
        $nama_rek_user = $_SESSION['nama_rek'];
    }
}
include 'db/koneksi.php';

$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? "https" : "http");
$base_url .= "://" . $_SERVER['HTTP_HOST'];
$base_url .= rtrim(dirname($_SERVER['SCRIPT_NAME']), '/\\');

$webQuery = mysqli_query($koneksi, "SELECT * FROM tb_web LIMIT 1");
$web = mysqli_fetch_assoc($webQuery);
$judul_pertama = strtok($web['judul_web'], ' ');

function isMobile()
{
    $agent = $_SERVER['HTTP_USER_AGENT'] ?? '';

    return preg_match(
        '/android|avantgo|blackberry|bolt|boost|cricket|docomo|fone|hiptop|mini|mobi|palm|phone|pie|tablet|webos|wos/i',
        $agent
    );
}

$mobile = isMobile();

?>

<!DOCTYPE html>
<html lang="id">

<head>
    <meta http-equiv="cache-control" content="cache">
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0, user-scalable=0"
        charset="UTF-8">
    <meta charset="utf-8">

    <title><?= $web['judul_web'] ?></title>
    <link rel="shortcut icon" href="<?= $base_url ?>/asset/img/<?= $web['favicon_web'] ?>" type="image/x-icon">

    <meta name="description" content="<?= $web['deskripsi_web'] ?>">
    <meta name="keywords" content="<?= $web['kata_kunci_web'] ?>">
    <link rel="canonical" href="<?= $base_url ?>/">

    <meta property="og:title" content="<?= $web['judul_web'] ?>">
    <meta property="og:description" content="<?= $web['deskripsi_web'] ?>">
    <meta property="og:url" content="<?= $base_url ?>">
    <meta property="og:type" content="website">
    <meta property="og:site_name" content="<?= $judul_pertama ?>">
    <meta property="og:locale" content="id_ID">
    <meta property="og:image" content="<?= $base_url ?>/asset/popup/<?= $web['popup_pengumuman_gambar'] ?>">
    <meta property="og:image:width" content="1200">
    <meta property="og:image:height" content="630">

    <meta name="twitter:card" content="summary_large_image">
    <meta name="twitter:title" content="<?= htmlspecialchars($web['judul_web']) ?>">
    <meta name="twitter:description" content="<?= htmlspecialchars($web['deskripsi_web']) ?>">
    <meta name="twitter:image" content="<?= $base_url ?>/asset/popup/<?= $web['popup_pengumuman_gambar'] ?>">
    <meta name="twitter:creator" content="@<?= strtolower(str_replace(' ', '', $judul_pertama)) ?>">

    <meta name="categories" content="website">

    <meta name="copyright" content="<?= $judul_pertama ?>">
    <meta name="webcrawlers" content="all">
    <meta name="spiders" content="all">
    <meta name="allow-search" content="yes">
    <meta name="robots" content="index, follow">
    <meta name="googlebot" content="index,follow">
    <meta name="YahooSeeker" content="index,follow">
    <meta name="msnbot" content="index,follow">
    <meta name="expires" content="never">
    <meta name="rating" content="general">
    <meta name="geo.region" content="ID">
    <meta name="geo.country" content="ID">
    <meta name="language" content="id-ID">
    <meta name="distribution" content="global">
    <meta name="geo.placename" content="Indonesia">
    <meta name="author" content="<?= $judul_pertama ?>">
    <meta name="publisher" content="<?= $judul_pertama ?>">

    <script type="application/ld+json">
    {
        "@context": "https://schema.org/",
        "@type": "Organization",
        "name": "<?= addslashes($judul_pertama) ?>",
        "url": "<?= $base_url ?>",
        "logo": "<?= $base_url ?>/assets/img/<?= $web['logo_web'] ?>",
        "description": "<?= addslashes($web['deskripsi_web']) ?>",
        "sameAs": [
            "<?= $web['facebook'] ?>",
            "<?= $web['telegram'] ?>",
            "<?= $web['whatsapp'] ?>"
        ]
    }
    </script>

    <script type="application/ld+json">
    {
        "@context": "https://schema.org",
        "@type": "WebSite",
        "url": "<?= $base_url ?>/",
        "potentialAction": {
            "@type": "SearchAction",
            "target": "<?= $base_url ?>/search?q={search_term_string}",
            "query-input": "required name=search_term_string"
        }
    }
    </script>

    <meta name="dc.title" content="<?= htmlspecialchars($web['judul_web']) ?>">
    <meta name="dc.creator" content="<?= htmlspecialchars($judul_pertama) ?>">
    <meta name="dc.publisher" content="<?= htmlspecialchars($judul_pertama) ?>">
    <meta name="dc.description" content="<?= htmlspecialchars($web['deskripsi_web']) ?>">
    <meta name="dc.language" content="id-ID">
    <meta name="dc.type" content="Text">
    <meta name="dc.coverage" content="Indonesia">

    <link rel="preload" href="/css/Open24DisplaySt.woff2" as="font" type="font/woff2" crossorigin="anonymous">
    <link rel="preload" href="/css/Teko-SemiBold.ttf" as="font" type="font/ttf" crossorigin="anonymous">
    <link rel="preload" href="/css/Poppins-Regular.ttf" as="font" type="font/ttf" crossorigin="anonymous">

    <link rel="stylesheet" href="vendor/fontawesome-free/css/all-min.css" type="text/css">
    <link rel="stylesheet"
        href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i">
    <link href="vendor/bootstrap/3.3.7/css/bootstrap.min.css" rel="stylesheet">

    <link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/font-awesome/4.7.0/css/font-awesome.min.css"
        type="text/css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.1/css/all.min.css">


    <link rel="stylesheet" href="./css/style.css">

    <style>
        :root {
            --primary-color:
                <?= $web['primary_color'] ?>
            ;
            --secondary-color:
                <?= $web['secondary_color'] ?>
            ;
            --tertiary-color:
                <?= $web['tertiary_color'] ?>
            ;
        }
    </style>

</head>

<body style="background-color:var(--secondary-color);">
    <?php include 'template/navbar.php'; ?>
    <script src="https://cdn.jsdelivr.net/npm/sweetalert2@11"></script>
</body>

</html>