<?php
ini_set('display_errors', 1);
ini_set('display_startup_errors', 1);
error_reporting(E_ALL);
$db3 = new SQLite3('./api/user_logs.db');
$db3->exec('CREATE TABLE IF NOT EXISTS logging(id INTEGER PRIMARY KEY AUTOINCREMENT NOT NULL, appid TEXT, version TEXT, device TEXT, pkg TEXT, app TEXT, cid TEXT, uid TEXT, status TEXT, d TEXT, time TEXT, last_online TEXT, ping TEXT)');
$conn_count = new SQLite3('./api/user_logs.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'];
session_start();

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


echo "<!DOCTYPE html>\n";
echo "<html lang=\"en\">\n";
echo "<head>\n";
echo "	<meta charset=\"utf-8\">\n";
echo "	<meta name=\"viewport\" content=\"width=device-width, initial-scale=1, shrink-to-fit=no\">\n";
echo "	<meta name=\"author\" content=\"FTG\">\n";
echo "	<link rel=\"stylesheet\" href=\"https://stackpath.bootstrapcdn.com/bootstrap/4.1.3/css/bootstrap.min.css\" integrity=\"sha384-MCw98/SFnGE8fJT3GXwEOngsV7Zt27NXFoaoApmYm81iuXoPkFOJwJ8ERdknLPMO\" crossorigin=\"anonymous\">\n";
echo "	<link href=\"https://cdn.datatables.net/1.10.20/css/jquery.dataTables.min.css\" rel=\"stylesheet\" />\n";
echo "	<link rel=\"stylesheet\" href=\"css/bootstrap-datetimepicker.css\">\n";
echo "\n";
echo "	<link href=\"css/themes/flatly/bootstrap.css\" rel=\"stylesheet\" title=\"main\">\n";
echo "	<link rel=\"stylesheet\" type=\"text/css\" href=\"https://cdn.datatables.net/1.10.19/css/dataTables.bootstrap4.min.css\">\n";
echo "	<link rel=\"stylesheet\" href=\"https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css\">\n";
echo "	<link href=\"css/simple-sidebar.css\" rel=\"stylesheet\">\n";
echo "	<link href=\"css/switch.css\" rel=\"stylesheet\" /> \n";
echo "</head>\n";
echo "\n";
echo "<body>\n";
echo "\n";
echo "  <div class=\"d-flex\" id=\"wrapper\">\n";
echo "	<!-- Sidebar -->\n";
echo "	<div class=\"\" id=\"sidebar-wrapper\">\n";
echo "	  <div class=\"sidebar-heading\">XCIPTV </div>\n";
echo "	  <span><a class=\"list-grup-item\" href=\"https://t.me/FireTVGuru\" target=\"_blank\">&nbsp&nbsp&nbsp&nbsp&#169  ".date("Y")." * FTG Panels * </a> </span></center>\n";
echo "	  <p>\n";
echo "	  <div class=\"list-group list-group-flush\">\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"app.php\">\n";
echo "		<i class=\"fa fa-cogs\"></i>	General Settings </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"interface.php\">\n";
echo "		<i class=\"fa fa-sliders\"></i>	Interface Settings </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"vpn.php\">\n";
echo "		<i class=\"fa fa-shield\" ></i>  OVPN Settings </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"theme.php\">\n";
echo "		<i class=\"fa fa-image\" ></i>  Theme Settings </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"player.php\">\n";
echo "		<i class=\"fa fa-play-circle\" ></i>	Player Selection </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"language.php\">\n";
echo "		<i class=\"fa fa-globe\" ></i>  Language Selection </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"announcement.php\">\n";
echo "		<i class=\"fa fa-bullhorn\" ></i>	 In-app Announcement </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"message.php\">\n";
echo "		<i class=\"fa fa-commenting\" ></i>  In-app Messages </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"messageall.php\">\n";
echo "		<i class=\"fa fa-commenting\" ></i>  In-app Messages To Everyone </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"sports.php\">\n";
echo "		<i class=\"fa fa-commenting\" ></i>  Sports Guide </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"all_users.php\">\n";
echo "		<i class=\"fa fa-commenting\" ></i>  Connected Users </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"appads.php\">\n";
echo "		<i class=\"fa fa-money\" ></i>  In-app Advertisements </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"parental_reset.php\">\n";
echo "		<i class=\"fa fa-lock\" ></i>	 Parental PIN Reset </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"maintenance.php\">\n";
echo "		<i class=\"fa fa-wrench\" ></i>  Maintenance Mode </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"update.php\">\n";
echo "		<i class=\"fa fa-cloud-upload\" ></i>	 Remote Update </a>\n";
echo "		<a class=\"list-group-item list-group-item-action \" href=\"user_update.php\">\n";
echo "		<i class=\"fa fa-user\" ></i>	 Update credentials </a>\n";
echo "	  </div>\n";
echo "	</div>\n";
echo "	<!-- /#sidebar-wrapper -->\n";
echo "\n";
echo "	<!-- Page Content -->\n";
echo "	<div id=\"page-content-wrapper\">\n";
echo "\n";
echo "\n";
echo "	  <nav class=\"navbar navbar-expand-lg navbar-dark \">\n";
echo "\n";
echo "		<button class=\"btn btn-primary\" id=\"menu-toggle\"><img src=\"img/logo.png\" width=\"25\" height=\"25\" class=\"d-flex justify-content-center text-allign centre\" alt=\"\"></button>\n";
echo "		\n";
echo "	  &nbsp;&nbsp;\n";
echo "\n";
echo "		<div class=\"btn-group\">\n";
echo "		<button type=\"button\" class=\"btn btn-warning dropdown-toggle\" data-toggle=\"dropdown\" aria-haspopup=\"true\" aria-expanded=\"false\">Themes</button>\n";
echo "		<div class=\"dropdown-menu\">\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"cerulean\"><i class=\"fa fa-pencil\"> Cerulean</i></a></li>      </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"cosmo\"><i class=\"fa fa-pencil\"> Cosmo</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"cyborg\"><i class=\"fa fa-pencil\"> Cyborg</i></a></li>          </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"darkly\"><i class=\"fa fa-pencil\"> Darkly (default)</i></a></li></strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"flatly\"><i class=\"fa fa-pencil\"> Flatly</i></a></li>          </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"journal\"><i class=\"fa fa-pencil\"> Journal</i></a></li>        </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"litera\"><i class=\"fa fa-pencil\"> Litera</i></a></li>          </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"lumen\"><i class=\"fa fa-pencil\"> Lumen</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"lux\"><i class=\"fa fa-pencil\"> Lux</i></a></li>                </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"materia\"><i class=\"fa fa-pencil\"> Materia</i></a></li>        </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"minty\"><i class=\"fa fa-pencil\"> Minty</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"pulse\"><i class=\"fa fa-pencil\"> Pulse</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"sandstone\"><i class=\"fa fa-pencil\"> Sandstone</i></a></li>    </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"simplex\"><i class=\"fa fa-pencil\"> Simplex</i></a></li>        </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"sketchy\"><i class=\"fa fa-pencil\"> Sketchy</i></a></li>        </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"slate\"><i class=\"fa fa-pencil\"> Slate</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"solar\"><i class=\"fa fa-pencil\"> Solar</i></a></li>            </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"spacelab\"><i class=\"fa fa-pencil\"> Spacelab</i></a></li>      </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"superhero\"><i class=\"fa fa-pencil\"> Superhero</i></a></li>    </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"united\"><i class=\"fa fa-pencil\"> United</i></a></li>          </strong></h5>\n";
echo "			<strong><h5><li><a href=\"#\" class=\"change-style-menu-item\" rel=\"yeti\"><i class=\"fa fa-pencil\"> Yeti</i></a></li>              </strong></h5>\n";
echo "		</div>\n";
echo "		</div>\n";
echo "		\n";
echo "		<a href=\"logout.php\" class=\"btn btn-danger ml-auto mr-1\">Logout</a>\n";
echo "	  </nav>\n";
echo "\n";
echo "\n";
echo "\n";
echo "	  <div class=\"container-fluid\"><br>\n";

$message = '<div class="alert alert-success" id="success-alert"><center><h4 style="color:white!important"><i class="icon fa fa-check"></i>Updated!</h4></center></div>';
if(isset($_GET['status'])){
	if ($_GET['status'] == '1'){
		echo $message;
	}
}
?>