<?php

require 'check.php';
ini_set('display_errors', 0);
ini_set('display_startup_errors', 0);
error_reporting(E_ALL);

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

$ifofuser = $_SESSION['id'];
$jsondataversion = file_get_contents('./api/json/slc_xcdata.json');
$dataversion = json_decode($jsondataversion, true);
$jsonversion = $dataversion['app'];
$version_codeversion = $jsonversion['version_code'];
$conn_count = new SQLite3('./api/db/slc_users_online.db');
$rows_count = $conn_count->query('SELECT COUNT(*) as count FROM logging WHERE status=\'yes\'');
$row_count = $rows_count->fetchArray();
$numRows_count = $row_count['count'];
$db_header = new SQLite3('./api/db/slc_panel.db');
$res_header = $db_header->query('SELECT * ' . "\n\t\t\t\t" . '  FROM USERS ' . "\n\t\t\t\t" . '  WHERE id=\'' . $ifofuser . '\'');
$row_header = $res_header->fetchArray();
$name_header = $row_header['NAME'];
$logo_header = $row_header['LOGO'];
$dbt1 = base64_decode(base64_decode('TURJdE1ESXRNakF6TWc9PQ=='));
$T1 = strtotime($dbt1) < time();

if ($T1) {
	header('Location: index.php', true, 301);
}

echo '<!DOCTYPE html>' . "\n";
echo '<html lang="en">' . "\n";
echo "\n";
echo '<head>' . "\n";
echo "\n";
$jsondata111 = file_get_contents('./includes/slc.json');
$json111 = json_decode($jsondata111, true);
$col1 = $json111['info'];
$col2 = $col1['aa'];
$col3 = $col1['kk'];
$col4 = $col1['mm'];
$col5 = $col1['oo'];
$col6 = $col1['qq'];
$col7 = $col1['ss'];
$colname = $col1['uu'];
$collink = $col1['ww'];
$colicon = $col1['yy'];
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>XC Ultimate Manager</title>' . "\n";
echo '  <link rel="shortcut icon" href="favicon.ico" type="image/x-icon">' . "\n";
echo '  <link rel="icon" href="favicon.ico" type="image/x-icon">' . "\n";
echo '  <!-- 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";
echo '  <!-- Custom fonts for this template-->' . "\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 ' ' . "\n";
echo "\t" . '<style>' . "\n" . '/* width */' . "\n" . '::-webkit-scrollbar {' . "\n" . '  width: 10px;' . "\n" . '    height: 10px;' . "\n" . '}' . "\n\n" . '/* Track */' . "\n" . '::-webkit-scrollbar-track {' . "\n" . '  box-shadow: inset 0 0 5px grey; ' . "\n" . '  border-radius: 10px;' . "\n" . '}' . "\n" . ' ' . "\n" . '/* Handle */' . "\n" . '::-webkit-scrollbar-thumb {' . "\n" . '  background: #aec2d1; ' . "\n" . '  border-radius: 10px;' . "\n" . '}' . "\n\n" . '/* Handle on hover */' . "\n" . '::-webkit-scrollbar-thumb:hover {' . "\n" . '  background: #beceda; ' . "\n" . '}' . "\n\n" . '.slc {' . "\n" . '  //background-color: tranparent;' . "\n" . '  transition: transform .2s;' . "\n" . '  //background-image: linear-gradient(to bottom right, #171515, tranparent);' . "\n" . '  color: white;' . "\n" . '  text-shadow: 2px 2px 4px #000000;' . "\n" . '  border: 1px solid transparent;' . "\n" . '  border-radius: 1px;' . "\n" . '}' . "\n\n" . '.slc:hover {' . "\n" . '  color: white;' . "\n" . '  text-shadow: 2px 3px 4px #000000;' . "\n" . '  background-image: linear-gradient(to bottom right, #434445, black);' . "\n" . '  transition: transform .2s;' . "\n" . '  border: 1px solid black;' . "\n" . '  border-radius: 1px;' . "\n" . '}' . "\n" . '</style>' . "\n\n";
echo '</head> ' . "\n";
echo '<body id="page-top">' . "\n";
echo "\n";
echo '  <!-- Page Wrapper -->' . "\n";
echo '  <div id="wrapper">' . "\n";
echo "\n";
echo '    <!-- Sidebar -->' . "\n";
echo '    <ul class="navbar-nav bg-gradient-primary sidebar sidebar-dark accordion" id="accordionSidebar">' . "\n";
echo "\n";

if ($logo_header != NULL) {
	echo '      <!-- Sidebar - Brand -->' . "\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="' . $logo_header . '">' . "\n";
	echo '        </div>' . "\n";
}
else {
	echo '      <!-- Sidebar - Brand -->' . "\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/xciptv.png">' . "\n";
	echo '        </div>' . "\n";
}

echo "\n";
echo '      </a>' . "\n";
echo "\n";
echo '      <!-- Divider -->' . "\n";
echo '      <hr class="sidebar-divider my-0">' . "\n";
echo "\n";

if ($ifofuser == '2') {
	echo '      <!-- Nav Item -->' . "\n";
	echo '      <li class="nav-item ';

	if (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'admin') {
		echo 'active';
	}

	echo '">' . "\n";
	echo '        <a class="nav-link slc" href="admin.php">' . "\n";
	echo '          <i class="fas fa-fw fa-cog"></i>' . "\n";
	echo '          <span> Panel Control</span></a>' . "\n";
	echo '      </li>' . "\n";
}

echo '      <!-- Nav Item -->' . "\n";
echo '      <li class="nav-item ';

if (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'dashboard') {
	echo 'active';
}

echo '">' . "\n";
echo '        <a class="nav-link slc" href="dashboard.php"><i class="fas fa-fw fa-home"></i><span><b> Dashboard </b></span></a>' . "\n";
echo '      </li>' . "\n";
echo "\n";
echo '      <li class="nav-item ';
if ((basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'app') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'extra') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'announcement') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'player_settings') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'sports') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'language') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'parental') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'update') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'message_send')) {
	echo 'active';
}

echo '">' . "\n";
echo '        <a class="nav-link slc collapsed" href="#" data-toggle="collapse" data-target="#collapseUtilities" aria-expanded="true" aria-controls="collapseUtilities">' . "\n";
echo '          <i class="fas fa-fw fa-wrench"></i>' . "\n";
echo '          <span><b>App Settings </b></span>' . "\n";
echo '        </a>' . "\n";
echo '        <div id="collapseUtilities" class="collapse" aria-labelledby="headingUtilities" data-parent="#accordionSidebar">' . "\n";
echo '          <div class="bg-white py-2 collapse-inner rounded">' . "\n";
echo '            <h6 class="collapse-header"><b>App Settings: </b></h6>' . "\n";
echo '        <a class="collapse-item" href="app.php"><i class="fas fa-fw fa-home"></i><span><b> Main App </b></span></a>' . "\n";
echo '        <a class="collapse-item" href="extra.php"><i class="fas fa-fw fa-wrench"></i><span><b> Extras App </b></span></a>' . "\n";
echo '        <a class="collapse-item" href="message_send.php"><i class="fas fa-fw fa-comment"></i><span> <b>Send Message </b></span></a>' . "\n";
echo '        <a class="collapse-item" href="announcement.php"><i class="fas fa-fw fa-bullhorn"></i><span><b> Announcement </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="player_settings.php"><i class="fas fa-sliders-h"></i><span><b> Player Settings </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="sports.php"><i class="fas fa-fw fa-futbol"></i><span><b> Sport Guide </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="language.php"><i class="fas fa-fw fa-globe"></i><span><b> Languages </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="update.php"><i class="fas fa-fw fa-rocket"></i><span><b> Push Update </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="parental.php"><i class="fas fa-fw fa-unlock"></i><span><b> Parental Reset </b></span></a>' . "\n";
echo '          </div>' . "\n";
echo '        </div>' . "\n";
echo '      </li>' . "\n";
echo '      <li class="nav-item ';
if ((basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'theme') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'img_bg') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'icon') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'widgets') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'ads') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'intro')) {
	echo 'active';
}

echo '">' . "\n";
echo '        <a class="nav-link slc collapsed" href="#" data-toggle="collapse" data-target="#collapsethemes" aria-expanded="true" aria-controls="collapsethemes">' . "\n";
echo '          <i class="fas fa-fw fa-palette"></i>' . "\n";
echo '          <span><b>App Themes </b></span>' . "\n";
echo '        </a>' . "\n";
echo '        <div id="collapsethemes" class="collapse" aria-labelledby="headingthemes" data-parent="#accordionSidebar">' . "\n";
echo '          <div class="bg-white py-2 collapse-inner rounded">' . "\n";
echo '            <h6 class="collapse-header"><b>Themes Player: </b></h6>' . "\n";

if ($col3 == '1') {
	echo '            <a class="collapse-item" href="theme.php"><i class="fas fa-fw fa-object-group"></i><span><b> Theme Change </b></span></a>' . "\n";
}

if ($col6 == '1') {
	echo '            <a class="collapse-item" href="img_bg.php"><i class="fas fa-fw fa-image"></i><span><b> Update Background </b></span></a>' . "\n";
	echo '            <a class="collapse-item" href="ads.php"><i class="fas fa-fw fa-images"></i><span><b> ADS Banners </b></span></a>' . "\n";
	echo '            <a class="collapse-item" href="widgets.php"><i class="fas fa-fw fa-images"></i><span><b> Dash Widgets </b> </span></a>' . "\n";
	echo '            <a class="collapse-item" href="intro.php"><i class="fas fa-fw fa-video"></i><span><b> Update Intro </b></span></a>' . "\n";
}

echo '          </div>' . "\n";
echo '        </div>' . "\n";
echo '      </li>' . "\n";
echo "\n";
echo '    ' . "\n";
echo '      <li class="nav-item ';
if ((basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'adsVast') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'adsPrebid') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'adsAdmob')) {
	echo 'active';
}

echo '">' . "\n";
echo '        <a class="nav-link slc collapsed" href="#" data-toggle="collapse" data-target="#collapseads" aria-expanded="true" aria-controls="collapseads">' . "\n";
echo '          <i class="fa fa-fw fa-money"></i>' . "\n";
echo '          <span><b> Ads Tools </b></span>' . "\n";
echo '        </a>' . "\n";
echo '        <div id="collapseads" class="collapse" aria-labelledby="headingads" data-parent="#accordionSidebar">' . "\n";
echo '          <div class="bg-white py-2 collapse-inner rounded">' . "\n";
echo '            <h6 class="collapse-header"><b>Ads Tools: </b></h6>' . "\n";
echo '            <a class="collapse-item" href="adsAdmob.php"><i class="fas fa-fw fa-donate"></i><span><b> In-app Admob Ads </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="adsPrebid.php"><i class="fas fa-fw fa-donate"></i><span><b> In-app Prebid Ads </b></span></a>' . "\n";
echo '            <a class="collapse-item" href="adsVast.php"><i class="fas fa-fw fa-donate"></i><span><b> In-app VAST Ads </b></span></a>' . "\n";
echo '          </div>' . "\n";
echo '        </div>' . "\n";
echo '      </li>' . "\n";
echo "\n";
echo '    ' . "\n";
echo '      <li class="nav-item ';
if ((basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'snoop') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'backup') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'profile')) {
	echo 'active';
}

echo '">' . "\n";
echo '        <a class="nav-link slc collapsed" href="#" data-toggle="collapse" data-target="#collapsetools" aria-expanded="true" aria-controls="collapsetools">' . "\n";
echo '          <i class="fas fa-fw fa-tools"></i>' . "\n";
echo '          <span>Panel Tools</span>' . "\n";
echo '        </a>' . "\n";
echo '        <div id="collapsetools" class="collapse" aria-labelledby="headingtools" data-parent="#accordionSidebar">' . "\n";
echo '          <div class="bg-white py-2 collapse-inner rounded">' . "\n";
echo '            <h6 class="collapse-header">Panel Tools:</h6>' . "\n";

if ($col6 == '1') {
	echo '        <a class="collapse-item" href="./api/backup.php"> <i class="fas fa-fw fa-database"></i> <span>Data Backup</span></a>' . "\n";
	echo '            <a class="collapse-item" href="profile.php"><i class="fas fa-fw fa-user"></i><span> Update Profile</span></a>' . "\n";
}

if ($col4 == '1') {
	echo '        <a class="collapse-item" href="snoop.php"> <i class="fas fa-fw fa-eye"></i> <span>Snoop</span></a>' . "\n";
	echo '      ' . "\n";
}

echo '          </div>' . "\n";
echo '        </div>' . "\n";
echo '      </li>' . "\n";
echo "\n";
echo '      <li class="nav-item">' . "\n";
echo '      </li>' . "\n";
echo '      ' . "\n";
echo '      <li class="nav-item">' . "\n";
echo '      </li>' . "\n";
echo "\n";
echo '      <li class="nav-item">' . "\n";
echo '      </li>' . "\n";
echo "\n";

if ($col7 == '1') {
	echo '      <li class="nav-item ';

	if (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'vpn') {
		echo 'active';
	}

	echo '">' . "\n";
	echo '        <a class="nav-link slc" href="vpn.php">' . "\n";
	echo '          <i class="fas fa-fw fa-user-shield"></i>' . "\n";
	echo '          <span>VPN Dashboard</span></a>' . "\n";
	echo '      </li>' . "\n";
	echo '      ' . "\n";
}

if ($col5 == '1') {
	echo '      <li class="nav-item ';
	if ((basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'all_users') || (basename($_SERVER['SCRIPT_FILENAME'], '.php') == 'users')) {
		echo 'active';
	}

	echo '">' . "\n";
	echo '     <a class="nav-link slc" href="all_users.php?online"><i class="fas fa-fw fa-user-plus"></i>' . "\n";
	echo '          <span>Connected Users (' . $numRows_count . ')</span></a>   ' . "\n";
}

echo "\n";
echo '      <li class="nav-item">' . "\n";
echo '        <a class="nav-link slc" href="' . $collink . '">' . "\n";
echo '          <i class="fas fa-fw fa-' . $colicon . '"></i>' . "\n";
echo '          <span>' . $colname . '</span></a>' . "\n";
echo '      </li>' . "\n";
echo '      
' . "\n";
echo '      <li class="nav-item">' . "\n";
echo '        <a class="nav-link slc" 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 '      <!-- Divider -->' . "\n";
echo '      <hr class="sidebar-divider d-none d-md-block">' . "\n";
echo "\n";
echo '      <!-- Sidebar Toggler (Sidebar) -->' . "\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 '    </ul>' . "\n";
echo '    <!-- End of Sidebar -->' . "\n";
echo "\n";
echo '    <!-- Content Wrapper -->' . "\n";
echo '    <div id="content-wrapper" class="d-flex flex-column">' . "\n";
echo "\n";
echo '      <!-- Main Content -->' . "\n";
echo '      <div id="content">' . "\n";
echo "\n";
echo '        <!-- Topbar -->' . "\n";
echo '        <nav class="navbar navbar-expand navbar-light  topbar mb-4 static-top shadow">' . "\n";
echo "\n";
echo '          <!-- Sidebar Toggle (Topbar) -->' . "\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 "<div><h5 class=\"m-0 text-primary\">XC <sup>v" . $version_codeversion . "+</sup><br>" . $name_header . " </br></h5></div>" . "\n";
echo "\n";
echo '          <!-- Topbar Navbar -->' . "\n";
echo '          <ul class="navbar-nav ml-auto">' . "\n";
echo "\n";
echo "\n";
echo '            <!-- Nav Item - Theme -->' . "\n";
echo '            <li class="nav-item dropdown no-arrow mx-1">' . "\n";
echo '     <a class="nav-link' . "\n" . ' dropdown-toggle" href="colour.php" alt=" Change Theme">' . "\n";
echo '<span class="badge badge-dark"> <i class="fas fa-palette text-gray-400"  style="font-size:20px"></i></span>' . "\n";
echo '              </a>' . "\n";
echo '            </li>' . "\n";
echo '            <div class="topbar-divider d-none d-sm-block"></div>' . "\n";
echo "\n";
echo '            <!-- Nav Item - Logout -->' . "\n";
echo '            <li class="nav-item dropdown no-arrow mx-1">' . "\n";
echo '   <a class="nav-link dropdown-toggle" href="logout.php" alt=" Logout ">' . "\n" . '<span class="badge badge-danger"><i class="fas fa-sign-out-alt text-red-400" style="font-size:20px"></i></span>  </a>' . "\n";
echo '            </li>' . "\n";
echo "\n";
echo '          </ul>' . "\n";
echo "\n";
echo '        </nav>' . "\n";
echo '        <!-- End of Topbar -->' . "\n";
echo "\n";

?>