<!------------------------------------------------------------------------->
<!-------------------------CONTATO-------------------------------->
<!----------------------https://globallweb.com.br/------------------------>
<!------------------------------------------------------------------------->


<?php
ini_set('display_errors', 1);
if(session_status() === PHP_SESSION_NONE) session_start();
include(__DIR__ . '/functions.php');
$adTypeJsonPath = __DIR__ . '/ad_type.json';
$adb = new SQLite3('./api/.adb.db');
$adb3 = new SQLite3('./api/.db_logo.db');
$adb4 = new SQLite3('./api/.db_bg.db'); 
$adTypeData = json_decode(file_get_contents($adTypeJsonPath), true);
$currentAdType = $adTypeData['adType'] ?? 'manual';

if ($currentAdType === 'tmdb') {
    $adsPageUrl = "tmdb_api.php";
} else {
    $adsPageUrl = "ads.php";
}

if (!isset($_SESSION['name'])) {
    header("Location: index.php");
    exit;
}

$log_check = $db->select('users', '*', 'id = :id', '', [':id' => 1]);
$loggedinuser = !empty($log_check) ? $log_check[0]['username'] : null;

if ($_SESSION['name'] !== $loggedinuser) {
    header("Location: index.php");
    exit;
}

?>

<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="utf-8">
    <meta name="viewport" content="width=device-width, initial-scale=1, shrink-to-fit=no">
    <meta name="author" content="Painel IBO">
    <link rel="stylesheet" href="https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css" integrity="sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO" crossorigin="anonymous">
    <link href="css/themes/darkly/bootstrap.css" rel="stylesheet" title="main">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/animate.css/3.2.3/animate.min.css">
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
    <link href="css/simple-sidebar.css" rel="stylesheet">
    <style>
        body {
            background-color: #181828;
            background-image: url("./img/binding_dark.webp");
            color: #fff;
        }

        #particles-js {
            background-size: cover;
            background-position: 50% 50%;
            background-repeat: no-repeat;
            background: #8000FF;
            display: flex;
            justify-content: center;
            align-items: center;
        }

        .particles-js-canvas-el {
            position: fixed;
        }

        #pageMessages {
            left: 50%;
            transform: translateX(-50%);
            position: fixed;
            text-align: center;
            top: 5px;
            width: 60%;
            z-index: 9999;
            border-radius: 0px;
        }

        .alert {
            position: relative;
        }

        .alert .close {
            position: absolute;
            top: 5px;
            right: 5px;
            font-size: 1em;
        }

        .alert .fa {
            margin-right: .3em;
        }

        .modal-dialog {
            display: flex;
            align-items: center;
            min-height: calc(100% - 1rem);
        }

        /* Efeito de borda com animação de degradê */
        @keyframes gradientAnimation {
            0% {
                border-image-source: linear-gradient(45deg, #ff6f00, #ff8e00, #ff8f00, #ff6f00);
            }
            50% {
                border-image-source: linear-gradient(45deg, #8e44ad, #f39c12, #d35400, #f1c40f);
            }
            100% {
                border-image-source: linear-gradient(45deg, #ff6f00, #ff8e00, #ff8f00, #ff6f00);
            }
        }

        .list-group-item {
            border-radius: 10px;
            background-color: #2c2f3d;
            color: #fff;
            margin: 10px 0;
            font-size: 16px;
            font-weight: 600;
            transition: all 0.3s ease;
            border: 2px solid transparent;
            border-image: linear-gradient(45deg, #ff6f00, #ff8e00, #ff8f00, #ff6f00);
            border-image-slice: 1;
            animation: gradientAnimation 3s infinite;
        }

        .list-group-item:hover {
            background-color: #4CAF50;
            color: white;
        }

        .sidebar-heading {
            font-size: 1.5rem;
            font-weight: bold;
            text-align: center;
            color: #fff;
            padding: 15px;
            background-color: #181828;
            border-radius: 10px;
        }

        /* Efeito de luz para destacar o texto */
        .light-effect {
            position: relative;
            display: inline-block;
            font-size: 1.5rem;
            font-weight: bold;
            color: #fff;
            text-align: center;
            background: linear-gradient(45deg, #ff6f00, #ff8e00, #ff8f00, #ff6f00);
            -webkit-background-clip: text;
            color: transparent;
            animation: glowing 1.5s infinite alternate;
        }

        @keyframes glowing {
            0% {
                text-shadow: 0 0 5px #ff6f00, 0 0 10px #ff6f00, 0 0 15px #ff8e00, 0 0 20px #ff8e00;
            }
            50% {
                text-shadow: 0 0 10px #ff6f00, 0 0 20px #ff8e00, 0 0 30px #ff8e00, 0 0 40px #ff8e00;
            }
            100% {
                text-shadow: 0 0 5px #ff6f00, 0 0 10px #ff8e00, 0 0 15px #ff8f00, 0 0 20px #ff6f00;
            }
        }

        .modal-content {
            background-color: #2c2f3d;
            border-radius: 10px;
            color: #fff;
        }

        .modal-header {
            border-bottom: 1px solid #444;
        }

        .close {
            color: #fff;
            font-size: 1.5rem;
        }

        .btn {
            border-radius: 10px;
            font-weight: bold;
        }

        .btn-primary {
            background-color: #5cb85c;
            border-color: #5cb85c;
        }

        .btn-danger {
            background-color: #d9534f;
            border-color: #d9534f;
        }

        #menu-toggle {
            border-radius: 10px;
            padding: 10px 15px;
        }
    </style>
</head>
<body>
<div id="js-particles"></div>

<div class="d-flex" id="wrapper">
    <!-- Sidebar -->
    <div id="sidebar-wrapper">
        <div class="sidebar-heading light-effect">IBO UNITV 4.1-V2</div>
        <span>
            <a class="list-group-item" href="https://globallweb.com.br/" target="_blank">&#169;  Mais Script Clique Aqui</a>
        </span>
        <div class="list-group list-group-flush">
            <a class="list-group-item list-group-item-action" href="dns.php">
                <i class="fa fa-cogs"></i>&nbsp;&nbsp;Ajustes de DNS
            </a>
            <a class="list-group-item list-group-item-action" href="dnsmax.php">
                <i class="fa fa-cogs"></i>&nbsp;&nbsp;Migração DNS
            </a>
            <a class="list-group-item list-group-item-action" href="playlists.php">
                <i class="fa fa-user"></i>&nbsp;&nbsp;Usuários conectados
            </a>
            <a class="list-group-item list-group-item-action" href="ads.php">
                <i class="fa fa-image"></i>&nbsp;&nbsp;Banners Anúncio 01
            </a>
            <a class="list-group-item list-group-item-action" href="ads4.php">
                <i class="fa fa-futbol-o"></i>&nbsp;&nbsp;Banners Anúncio 02
            </a>
            <a class="list-group-item list-group-item-action" href="ads3.php">
                <i class="fa fa-futbol-o"></i>&nbsp;&nbsp;Banners Anúncio 03
            </a>
            <a class="list-group-item list-group-item-action" href="ads2.php">
                <i class="fa fa-futbol-o"></i>&nbsp;&nbsp;Anúncios Sport's
            </a>
            <a class="list-group-item list-group-item-action" href="mRTXAdsSetting.php">
                <i class="fa fa-image"></i>&nbsp;&nbsp;Autoads/Manual
            </a>
            <a class="list-group-item list-group-item-action" href="#" data-toggle="modal" data-target="#customizeModal">
                <i class="fa fa-cogs"></i>&nbsp;&nbsp;Personalizar&nbsp;&nbsp;
                <i class="fa fa-chevron-down" style="margin-left: 60px;"></i>
            </a>
            <a class="list-group-item list-group-item-action" href="qrcode.php">
                <i class="fa fa-image"></i>&nbsp;&nbsp;QR Code
            </a>
            <a class="list-group-item list-group-item-action" href="base64.php">
                <i class="fa fa-cogs"></i>&nbsp;&nbsp;API Config
            </a>
            <a class="list-group-item list-group-item-action" href="pagamento.php">
                <i class="fa fa-image"></i>&nbsp;&nbsp;Pagamento
            </a>
            <a class="list-group-item list-group-item-action" href="user.php">
                <i class="fa fa-lock"></i>&nbsp;&nbsp;Update Credentials
            </a>
        </div>
    </div>
    <!-- /#sidebar-wrapper -->
    
    <div class="modal fade" id="customizeModal" tabindex="-1" role="dialog" aria-labelledby="customizeModalLabel" aria-hidden="true">
        <div class="modal-dialog" role="document">
            <div class="modal-content">
                <div class="modal-header">
                    <h5 class="modal-title" id="customizeModalLabel">Personalizar</h5>
                    <button type="button" class="close" data-dismiss="modal" aria-label="Close">
                        <span aria-hidden="true">&times;</span>
                    </button>
                </div>
                <div class="modal-body">
                    <a class="dropdown-item" href="logo.php">
                        <i class="fa fa-image"></i>&nbsp;&nbsp;Mudar Logo
                    </a>
                    <a class="dropdown-item" href="bg.php">
                        <i class="fa fa-image"></i>&nbsp;&nbsp;Mudar Fundo
                    </a>
                    <a class="dropdown-item" href="edit_texto.php">
                        <i class="fa fa-envelope"></i>&nbsp;&nbsp;Enviar Mensagem
                    </a>
                </div>
            </div>
        </div>
    </div>

    <!-- Page Content -->
    <div id="page-content-wrapper">
        <nav class="navbar navbar-expand-lg navbar-dark">
            <button class="btn btn-primary" id="menu-toggle">
                <img src="img/logo1.png" width="25" height="25" class="d-flex justify-content-center text-align centre" alt="">
            </button>
            &nbsp;&nbsp;
            <div class="center" id="pageMessages"></div>
            <a href="logout.php" class="btn btn-danger ml-auto mr-1">Sair</a>
        </nav>
        <div class="container-fluid"><br>
