<?php


session_start();
if (!isset($_SESSION["boxbr_admin_apk"])) {
    header("location:login.php");
    exit;
}

if($_POST){
    file_put_contents("a/app_dns", $_POST['dns']);
    file_put_contents("a/app_url", $_POST['url']);
}

$mac_count = $db->query("SELECT COUNT(*) as count FROM flixiptv");
$mac_count = $mac_count->fetch_array();
$mac_count = $mac_count["count"];

$resboxbr = $db->query("SELECT * FROM users WHERE ID='1'");
$rowboxbr = $resboxbr->fetch_array();
$nameboxbr = $rowboxbr["NAME"];
$logoboxbr = $rowboxbr["LOGO"];
echo "<!DOCTYPE html>\n<html lang=\"en\">\n\n<head>\n\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  <meta http-equiv=\"X-UA-Compatible\" content=\"IE=edge\">\n  <meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n  <meta name=\"description\" content=\"\">\n  <meta name=\"author\" content=\"\">\n  <meta name=\"google\" content=\"notranslate\">\n  <script src=\"https://kit.fontawesome.com/3794d2f89f.js\" crossorigin=\"anonymous\"></script>\n  <title>BoxBR Flix Manager</title>\n    <link rel=\"shortcut icon\" href=\"./img/logo.png\" type=\"image/png\">\n    <link rel=\"icon\" href=\"./img/logo.png\" type=\"image/png\">\n  <!-- Custom styles for this template-->\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  <!-- Custom fonts for this template-->\n  <link href=\"vendor/fontawesome-free/css/all.min.css\" rel=\"stylesheet\" type=\"text/css\">\n  <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 \n</head> \n<body id=\"page-top\">\n\n  <!-- Page Wrapper -->\n  <div id=\"wrapper\">\n\n    <!-- Sidebar -->\n    <ul class=\"navbar-nav bg-gradient-primary sidebar sidebar-dark accordion\" id=\"accordionSidebar\">\n\n";
if ($logoboxbr != NULL) {
    echo "      <!-- Sidebar - Brand -->\n      <a class=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"boxbr.php\">\n        <div class=\"sidebar-brand-icon\">\n";
    echo "          <img class=\"img-profile rounded-circle\" width=\"65px\" src=\"" . $logoboxbr . "\">" . "\n";
    echo "        </div>\n";
} else {
    echo "      <!-- Sidebar - Brand -->\n      <a class=\"sidebar-brand d-flex align-items-center justify-content-center\" href=\"boxbr.php\">\n        <div class=\"sidebar-brand-icon\">\n          <img class=\"img-profile rounded-circle\" width=\"65px\" src=\"img/logo.png\">\n        </div>\n";
}
echo "\n      </a>\n\n      <!-- Divider -->\n      <hr class=\"sidebar-divider my-0\">\n\n      <!-- Nav Item -->\n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"users.php\">\n          <i class=\"fas fa-fw fa-user-plus\"></i>\n";
echo "          <span>Users (" . $mac_count . ")</span></a>" . "\n";
echo "      </li>\n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"advert.php\">\n          <i class=\"fas fa-fw fa fa-picture-o\"></i>\n          <span>Adverts</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"theme.php\">\n          <i class=\"fas fa-fw fa-paint-brush\"></i>\n          <span>Themes</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"epg.php\">\n          <i class=\"fas fa-fw fa-list\"></i>\n          <span>EPG Url</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"sports.php\">\n          <i class=\"fas fa-futbol\"></i> \n          <span>Sport Guide ( oldflix )</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"update.php\">\n          <i class=\"fas fa-fw fa fa-refresh\"></i>\n          <span>Apk Update</span></a>\n      </li>\n\n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"snoop.php\">\n          <i class=\"fas fa-fw fa-eye\"></i>\n          <span>Snoop</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"profile.php\">\n          <i class=\"fas fa-fw fa-user\"></i>\n          <span>Profile</span></a>\n      </li>\n      <li class=\"nav-item\">\n        <a class=\"nav-link\" href=\"logout.php\">\n          <i class=\"fas fa-fw fa fa-sign-out\"></i>\n          <span>Logout</span></a>\n      </li>\n      \n      <li class=\"nav-item\">\n        <a class=\"nav-link collapsed\" href=\"#\" data-toggle=\"collapse\" data-target=\"#collapsePages\" aria-expanded=\"true\" aria-controls=\"collapsePages\">\n          <i class=\"fas fa-fw fa-cloud\"></i>\n          <span>Cloud</span>\n        </a>\n        
    
    


<div id=\"collapsePages\" class=\"collapse\" aria-labelledby=\"headingPages\" data-parent=\"#accordionSidebar\">\n        <div class=\"bg-white py-2 collapse-inner rounded\">\n            <h6 class=\"collapse-header\">Cloud Uploads:</h6>\n        <a class=\"collapse-item\" href=\"https://www.filelinked.com/login\" target=\"_blank\"><i class=\"fas fa-fw fa-share\"></i><span> FileLinked</span></a>\n        <a class=\"collapse-item\" href=\"https://db.tt\" target=\"_blank\"><i class=\"fas fa-fw fa-share\"></i><span> DropBox</span></a>\n        <a class=\"collapse-item\" href=\"https://mega.nz/\" target=\"_blank\"><i class=\"fas fa-fw fa-share\"></i><span> Mega</span></a>\n          </div>\n        </div>\n      </li>\n\n      <!-- Divider -->\n      <hr class=\"sidebar-divider d-none d-md-block\">\n\n      <!-- Sidebar Toggler (Sidebar) -->\n      <div class=\"text-center d-none d-md-inline\">\n        <button class=\"rounded-circle border-0\" id=\"sidebarToggle\"></button>\n      </div>\n         <footer class=\"sticky-footer\">\n          <div class=\"copyright text-center\">\n            <span></a></span>";


$app_dns = file_get_contents('a/app_dns');
$app_url = file_get_contents('a/app_url');

echo "
    <div>
    <form method='POST'>
        <b>Dados do App</b><br><br>
        <label>DNS</label>
        <input class='form-control' type='text' name='dns' placeholder='DNS' value='$app_dns'/><br>
        <label>URL</label>
        <input class='form-control' type='text' name='url' placeholder='URL' value='$app_url' /><br>
        <button class='btn btn-success'>Salvar</button>
    </form>
    </div>

</ul>\n    <!-- End of Sidebar -->
    
    

\n\n    <!-- Content Wrapper -->\n    <div id=\"content-wrapper\" class=\"d-flex flex-column\">\n\n      <!-- Main Content -->\n      <div id=\"content\">\n\n        <!-- Topbar -->\n        <nav class=\"navbar navbar-expand navbar-light  topbar mb-4 static-top shadow\">\n\n          <!-- Sidebar Toggle (Topbar) -->\n          <button id=\"sidebarToggleTop\" class=\"btn btn-link d-md-none rounded-circle mr-3\">\n            <i class=\"fa fa-bars\"></i>\n          </button>\n
";
echo "<div><h5 class=\"m-0 text-primary\">BoxBR Flix Manager<br>" . $nameboxbr . " </br></h5></div>" . "\n";
echo "\n          <!-- Topbar Navbar -->\n          <ul class=\"navbar-nav ml-auto\">\n\n\n            <!-- Nav Item - Theme -->\n            <li class=\"nav-item dropdown no-arrow mx-1\">\n              <a class=\"nav-link dropdown-toggle\" href=\"boxbr.php\">\n               <i class=\"fas fa-palette text-gray-400\"></i><span class=\"badge badge-success\">Change Theme</span>\n              </a>\n            </li>\n            <div class=\"topbar-divider d-none d-sm-block\"></div>\n\n            <!-- Nav Item - Logout -->\n            <li class=\"nav-item dropdown no-arrow mx-1\">\n              <a class=\"nav-link dropdown-toggle\" href=\"logout.php\"><span class=\"badge badge-danger\">Logout</span>\n                <i class=\"fas fa-sign-out-alt fa-sm fa-fw mr-2 text-red-400\"></i>\n              </a>\n            </li>\n\n          </ul>\n\n        </nav>\n        <!-- End of Topbar -->\n\n";

?>