<?php

session_start();

if (!isset($_SESSION['loggedin'])) {
    header('location:login.php');
    exit();
}

$dbboxbrpainel = new SQLite3('./api/.boxbrpanels.db');
$resboxbr = $dbboxbrpainel->query('SELECT * FROM USERS WHERE ID=\'1\'');
$rowboxbr = $resboxbr->fetchArray();
$nameboxbr = $rowboxbr['NAME'];
$logoboxbr = $rowboxbr['LOGO'];
echo '<!DOCTYPE html>' . "\n";
echo '<html lang="en">' . "\n";
echo "\n";
echo '<head>' . "\n";
echo "\n";
$jsondata111 = file_get_contents('./includes/boxbr.json');
$json111 = json_decode($jsondata111, true);
$col1 = $json111['info'];
$col2 = $col1['aa'];
$col3 = $col2;
echo '    <meta charset="utf-8">' . "\n";
echo '    <meta http-equiv="X-UA-Compatible" content="IE=edge">' . "\n";
echo '    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">' . "\n";
echo '    <meta name="description" content="">' . "\n";
echo '    <meta name="author" content="">' . "\n";
echo '    <meta name="google" content="notranslate">' . "\n";
echo '    <script src="https://kit.fontawesome.com/3794d2f89f.js" crossorigin="anonymous"></script>' . "\n";
echo '    <title>ZuniTV P2PLAY APPS</title>' . "\n";
echo '    <link rel="shortcut icon" href="./img/logo.png" type="image/png">' . "\n";
echo '    <link rel="icon" href="./img/logo.png" type="image/png">' . "\n";
echo '    ' . "\n";
echo '    <link href="css/sb-admin-' . $col2 . '.css" rel="stylesheet">' . "\n";
echo '    <link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.min.css"/>' . "\n";
echo '    ' . "\n";
echo '    <link href="vendor/fontawesome-free/css/all.min.css" rel="stylesheet" type="text/css">' . "\n";
echo '    <link href="https://fonts.googleapis.com/css?family=Nunito:200,200i,300,300i,400,400i,600,600i,700,700i,800,800i,900,900i" rel="stylesheet">' . "\n";
echo '    <style>' . "\n";
echo '        .sidebar {' . "\n";
echo '            background-color: #2c3e50 !important; /* Darker sidebar background */' . "\n";
echo '            background-image: url(\'./img/sidebar-bg.jpg\'); /* Replace with your image path */' . "\n";
echo '            background-size: cover;' . "\n";
echo '            background-repeat: no-repeat;' . "\n";
echo '        }' . "\n";
echo '        .sidebar .nav-item .nav-link {' . "\n";
echo '            color: #ecf0f1 !important; /* Light text for dark background */' . "\n";
echo '            transition: all 0.3s ease;' . "\n";
echo '        }' . "\n";
echo '        .sidebar .nav-item .nav-link:hover {' . "\n";
echo '            transform: translateX(5px) scale(1.02); /* Slide and slightly grow on hover */' . "\n";
echo '            background-color: rgba(255, 255, 255, 0.05) !important; /* Subtle hover background */' . "\n";
echo '            color: #f39c12 !important; /* Accent color on hover */' . "\n";
echo '        }' . "\n";
echo '        .sidebar-divider {' . "\n";
echo '            border-top: 1px solid rgba(255, 255, 255, 0.2) !important;' . "\n";
echo '            margin: 0.8rem 0;' . "\n";
echo '        }' . "\n";
echo '        .sidebar-brand {' . "\n";
echo '            background-color: rgba(0, 0, 0, 0.1) !important; /* Slightly transparent brand background */' . "\n";
echo '            border-bottom: 1px solid rgba(255, 255, 255, 0.1) !important;' . "\n";
echo '        }' . "\n";
echo '        .sidebar-brand .sidebar-brand-text {' . "\n";
echo '            color: #ffffff !important; /* White brand text color */' . "\n";
echo '            font-weight: bold;' . "\n";
echo '            text-shadow: 1px 1px 2px rgba(0, 0, 0, 0.5); /* Text shadow for better visibility */' . "\n";
echo '        }' . "\n";
echo '        .topbar {' . "\n";
echo '            background-color: #34495e !important; /* Darker topbar background */' . "\n";
echo '            border-bottom: 1px solid #2c3e50 !important;' . "\n";
echo '            box-shadow: 0 0.15rem 0.25rem rgba(0, 0, 0, 0.1); /* Subtle shadow */' . "\n";
echo '        }' . "\n";
echo '        .topbar .navbar-nav .nav-item .nav-link {' . "\n";
echo '            color: #ecf0f1 !important;' . "\n";
echo '            transition: color 0.3s ease;' . "\n";
echo '        }' . "\n";
echo '        .topbar .navbar-nav .nav-item .nav-link:hover {' . "\n";
echo '            color: #f39c12 !important;' . "\n";
echo '        }' . "\n";
echo '        .topbar .navbar-nav .nav-item .nav-link .badge {' . "\n";
echo '            font-size: 0.7rem;' . "\n";
echo '            font-weight: bold;' . "\n";
echo '            position: absolute;' . "\n";
echo '            top: 0.2rem;' . "\n";
echo '            right: 0.1rem;' . "\n";
echo '            border-radius: 50%;' . "\n";
echo '            padding: 0.25rem 0.35rem;' . "\n";
echo '        }' . "\n";
echo '        .text-primary {' . "\n";
echo '            color: #f39c12 !important;' . "\n";
echo '        }' . "\n";
echo '        #sidebarToggleTop {' . "\n";
echo '            color: #ecf0f1 !important;' . "\n";
echo '        }' . "\n";
echo '        #sidebarToggleTop:hover {' . "\n";
echo '            color: #f39c12 !important;' . "\n";
echo '        }' . "\n";
echo '        .sidebar-card {' . "\n";
echo '            background: rgba(0, 0, 0, 0.1);' . "\n";
echo '            color: #ffffff;' . "\n";
echo '            border-radius: 0.35rem;' . "\n";
echo '            margin: 1rem auto;' . "\n";
echo '            padding: 1rem;' . "\n";
echo '        }' . "\n";
echo '    </style>' . "\n";
echo '</head>' . "\n";
echo '<body id="page-top">' . "\n";
echo "\n";
echo '    ' . "\n";
echo '    <div id="wrapper">' . "\n";
echo "\n";
echo '        ' . "\n";
echo '        <ul class="navbar-nav sidebar sidebar-dark accordion" id="accordionSidebar">' . "\n";
echo "\n";

if ($logoboxbr != NULL) {
    echo '            ' . "\n";
    echo '            <a class="sidebar-brand d-flex align-items-center justify-content-center" href="colour.php">' . "\n";
    echo '                <div class="sidebar-brand-icon">' . "\n";
    echo '                    <img class="img-profile rounded-circle" width="65px" src="' . $logoboxbr . '">' . "\n";
    echo '                </div>' . "\n";
    echo '                <div class="sidebar-brand-text mx-3">Apk Manager</div>' . "\n";
    echo '            </a>' . "\n";
} else {
    echo '            ' . "\n";
    echo '            <a class="sidebar-brand d-flex align-items-center justify-content-center" href="colour.php">' . "\n";
    echo '                <div class="sidebar-brand-icon">' . "\n";
    echo '                    <img class="img-profile rounded-circle" width="65px" src="img/logo.png">' . "\n";
    echo '                </div>' . "\n";
    echo '                <div class="sidebar-brand-text mx-3">Apk Manager</div>' . "\n";
    echo '            </a>' . "\n";
}

echo '            ' . "\n";
echo '            <hr class="sidebar-divider my-0">' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="dns.php">' . "\n";
echo '                    <i class="fas fa-fw fa-solid fa-wrench"></i>' . "\n";
echo '                    <span>DNS</span></a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";

// Seção do botão "Snoop" removida
// echo '            ' . "\n";
// echo '            <li class="nav-item">' . "\n";
// echo '                <a class="nav-link" href="snoop.php">' . "\n";
// echo '                    <i class="fas fa-fw fa-eye"></i>' . "\n";
// echo '                    <span>Snoop</span></a>' . "\n";
// echo '            </li>' . "\n";
// echo "\n";
// echo '            ' . "\n";
// echo '            <hr class="sidebar-divider">' . "\n";
// echo "\n";

echo '            ' . "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="usuarios.php">' . "\n";
echo '                    <i class="fas fa-fw fa-users"></i>' . "\n";
echo '                    <span>Usuários</span></a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";
//echo '            ' . "\n";
//echo '            <li class="nav-item">' . "\n";
//echo '                <a class="nav-link" href="painel_jogos.php">' . "\n";
//echo '                    <i class="fas fa-fw fa-users"></i>' . "\n";
//echo '                    <span>Api Jogos</span></a>' . "\n";
//echo '            </li>' . "\n";
//echo "\n";
//echo '            ' . "\n";
//echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";

// Seção do botão "Logo" removida
// echo '            ' . "\n";
// echo '            <li class="nav-item">' . "\n";
// echo '                <a class="nav-link" href="upload_logo.php">' . "\n";
// echo '                    <i class="fas fa-fw fa-image"></i>' . "\n";
// echo '                    <span>Logo</span></a>' . "\n";
// echo '            </li>' . "\n";
// echo "\n";
// echo '            ' . "\n";
// echo '            <hr class="sidebar-divider">' . "\n";
// echo "\n";

// Seção do botão "Fundo" removida
// echo '            ' . "\n";
// echo '            <li class="nav-item">' . "\n";
// echo '                <a class="nav-link" href="upload_bg.php">' . "\n";
// echo '                    <i class="fas fa-fw fa-desktop"></i>' . "\n";
// echo '                    <span>Fundo</span></a>' . "\n";
// echo '            </li>' . "\n";
// echo "\n";
// echo '            ' . "\n";
// echo '            <hr class="sidebar-divider">' . "\n";
// echo "\n";

echo '            ' . "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="banners.php">' . "\n";
echo '                    <i class="fas fa-fw fa-desktop"></i>' . "\n";
echo '                    <span>Banners</span></a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";

// Seção do botão "Qrcode" removida
// echo '            ' . "\n";
// echo '            <li class="nav-item">' . "\n";
// echo '                <a class="nav-link" href="qrcode.php">' . "\n";
// echo '                    <i class="fas fa-fw fa-desktop"></i>' . "\n";
// echo '                    <span>Qrcode</span></a>' . "\n";
// echo '            </li>' . "\n";
// echo "\n";
// echo '            ' . "\n";
// echo '            <hr class="sidebar-divider">' . "\n";
// echo "\n";

//echo '            ' . "\n";
//echo '            <li class="nav-item">' . "\n";
//echo '                <a class="nav-link" href="gerar_chave.php">' . "\n";
//echo '                    <i class="fas fa-fw fa-user"></i>' . "\n";
//echo '                    <span>Api</span></a>' . "\n";
//echo '            </li>' . "\n";
//echo "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="upload_app.php">' . "\n";
echo '                    <i class="fas fa-fw fa-user"></i>' . "\n";
echo '                    <span>Atualização OTA</span></a>' . "\n";
echo '            </li>' . "\n";
echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="profile.php">' . "\n";
echo '                    <i class="fas fa-fw fa-user"></i>' . "\n";
echo '                    <span>Profile</span></a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <hr class="sidebar-divider">' . "\n";
echo "\n";
echo '            <li class="nav-item">' . "\n";
echo '                <a class="nav-link" href="logout.php">' . "\n";
echo '                    <i class="fas fa-fw fa fa-sign-out"></i>' . "\n";
echo '                    <span>Logout</span></a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <hr class="sidebar-divider d-none d-md-block">' . "\n";
echo "\n";
echo '            <div class="text-center d-none d-md-inline">' . "\n";
echo '                <button class="rounded-circle border-0" id="sidebarToggle"></button>' . "\n";
echo '            </div>' . "\n";
echo "\n";
echo '            <div class="sidebar-card d-none d-lg-flex text-center">' . "\n";
echo '                <p class="text-white small mb-2">V2</p>' . "\n";
echo '            </div>' . "\n";
echo "\n";
echo '        </ul>' . "\n";
echo '        ' . "\n";
echo "\n";
echo '        ' . "\n";
echo '        <div id="content-wrapper" class="d-flex flex-column">' . "\n";
echo "\n";
echo '            ' . "\n";
echo '            <div id="content">' . "\n";
echo "\n";
echo '                ' . "\n";
echo '                <nav class="navbar navbar-expand navbar-light topbar mb-4 static-top shadow">' . "\n";
echo "\n";
echo '                    ' . "\n";
echo '                    <button id="sidebarToggleTop" class="btn btn-link d-md-none rounded-circle mr-3">' . "\n";
echo '                        <i class="fa fa-bars"></i>' . "\n";
echo '                    </button>' . "\n";
echo "\n";
echo '                    <div><h5 class="m-0 text-primary">' . $nameboxbr . '</h5></div>' . "\n";
echo "\n";
echo '                    ' . "\n";
echo '                    <ul class="navbar-nav ml-auto">' . "\n";
echo "\n";
echo "\n";
echo '                        ' . "\n";
echo '                        <li class="nav-item dropdown no-arrow mx-1">' . "\n";
echo '                            <a class="nav-link dropdown-toggle" href="colour.php">' . "\n";
echo '                               <i class="fas fa-palette text-gray-400"></i><span class="badge badge-warning">Mudar Tema</span>' . "\n";
echo '                            </a>' . "\n";
echo '                        </li>' . "\n";
echo '                        <div class="topbar-divider d-none d-sm-block"></div>' . "\n";
echo "\n";
echo "\n";
echo '                        ' . "\n";
echo '                        <li class="nav-item dropdown no-arrow mx-1">' . "\n";
echo '                            <a class="nav-link dropdown-toggle" href="logout.php"><span class="badge badge-danger">Logout</span>' . "\n";
echo '                                <i class="fas fa-sign-out-alt fa-sm fa-fw mr-2 text-red-400"></i>' . "\n";
echo '                            </a>' . "\n";
echo '                        </li>' . "\n";
echo "\n";
echo '                    </ul>' . "\n";
echo "\n";
echo '                </nav>' . "\n";
echo '                ' . "\n";
echo "\n";

?>