<?php
@session_start();
$db = new SQLite3('./api/.db.db');
$log_check = $db->query("SELECT * FROM users WHERE id='1'");
$roe = $log_check->fetchArray();
$loggedinuser = $roe['username'];

if (!isset($_SESSION['loggedinLaucheV'])) {
    header("location:"."index.php");
    exit();
}
?>
<!DOCTYPE html>
<html lang="pt">
<head>
    <meta charset="utf-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1, shrink-to-fit=no">
    <title>Painel My Launcher</title>
    <link rel="icon" type="image/x-icon" href="img/log0.png"/>
    <link href="assets/css/loader.css" rel="stylesheet" type="text/css" />
    <script src="assets/js/loader.js"></script>

    <!-- BEGIN GLOBAL MANDATORY STYLES -->
    <link href="https://fonts.googleapis.com/css?family=Quicksand:400,500,600,700&display=swap" rel="stylesheet">
    <link href="bootstrap/css/bootstrap.min.css" rel="stylesheet" type="text/css" />
    <link href="assets/css/plugins.css" rel="stylesheet" type="text/css" />
    <!-- END GLOBAL MANDATORY STYLES -->

    <!-- BEGIN PAGE LEVEL PLUGINS/CUSTOM STYLES -->
    <link href="plugins/apex/apexcharts.css" rel="stylesheet" type="text/css">
    <link href="assets/css/dashboard/dash_2.css" rel="stylesheet" type="text/css" />
    <!-- END PAGE LEVEL PLUGINS/CUSTOM STYLES -->
    <link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/4.7.0/css/font-awesome.min.css">
      <!-- BEGIN PAGE LEVEL STYLES -->
    <link rel="stylesheet" type="text/css" href="plugins/table/datatable/datatables.css">
    <link rel="stylesheet" type="text/css" href="plugins/table/datatable/dt-global_style.css">
    <link rel="stylesheet" type="text/css" href="plugins/table/datatable/custom_dt_multiple_tables.css">
    <!-- END PAGE LEVEL STYLES -->
  <!-- Custom styles for this template-->
  <style>
       .alert-success
    {
            color: white;
            background-color: #2780e3 !important;
            border:none;
    }
  </style>
 
  <link rel="stylesheet" type="text/css" href="css/jquery.datetimepicker.min.css"/>

</head>
<body class="alt-menu sidebar-noneoverflow">
    <!-- BEGIN LOADER -->
    <div id="load_screen"> <div class="loader"> <div class="loader-content">
        <div class="spinner-grow align-self-center"></div>
    </div></div></div>
    <!--  END LOADER -->

    <!--  BEGIN NAVBAR  -->
    <div class="header-container">
        <header class="header navbar navbar-expand-sm">

            <a href="#" class="sidebarCollapse" data-placement="bottom"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-menu"><line x1="3" y1="12" x2="21" y2="12"></line><line x1="3" y1="6" x2="21" y2="6"></line><line x1="3" y1="18" x2="21" y2="18"></line></svg></a>

            <div class="nav-logo align-self-center">
                <a class="navbar-brand" href="#"><img alt="logo" src="img/log0.png"> <span class="navbar-brand-name">My Launcher</span></a>
            </div>

            <ul class="navbar-item flex-row ml-auto nav-dropdowns">
                <li class="nav-item dropdown user-profile-dropdown order-lg-0 order-1">
                    <a class="nav-link dropdown-toggle user" id="user-profile-dropdown" data-toggle="dropdown" aria-haspopup="true" aria-expanded="true">
                        <div class="media">
                            <img src="img/sair.png" class="img-fluid" alt="admin-profile">
                            <div class="media-body align-self-center">
                                <h6><span>Ola,</span> <?= isset($_SESSION['N']) ? $_SESSION['N'] : 'Usuário' ?></h6>
                            </div>
                        </div>
                        <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>
                    </a>
                    <div class="dropdown-menu position-absolute animated fadeInUp" aria-labelledby="user-profile-dropdown">
                        <div class="">
                            <div class="dropdown-item">
                                <a class="" href="logout.php"><svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-log-out"><path d="M9 21H5a2 2 0 0 1-2-2V5a2 2 0 0 1 2-2h4"></path><polyline points="16 17 21 12 16 7"></polyline><line x1="21" y1="12" x2="9" y2="12"></line></svg>Sair Agora</a>
                            </div>
                        </div>
                    </div>
                </li>
            </ul>
        </header>
    </div>
    <!--  END NAVBAR  -->

    <!--  BEGIN MAIN CONTAINER  -->
    <div class="main-container" id="container">

        <div class="overlay"></div>
        <div class="search-overlay"></div>

        <!--  BEGIN TOPBAR  -->
        <div class="topbar-nav header navbar" role="banner">
            <nav id="topbar">
                <ul class="list-unstyled menu-categories" id="topAccordion">
                    <li class="menu single-menu <?php if(basename($_SERVER["SCRIPT_FILENAME"]) == 'resale'){echo('active');}?>">
                        <a href="config_app.php">
                            <div class="">
                                <i class="fa fa-home fa-1x"></i>
                                <span>Configuração Geral</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu single-menu <?php if(basename($_SERVER["SCRIPT_FILENAME"]) == 'extra'){echo('active');}?>">
                        <a href="view_apps.php">
                            <div class="">
                                <i class="fa fa-wrench mr-1"></i>
                                <span>Aplicativos</span>
                            </div>
                        </a>
                    </li>
                    
                    <li class="menu single-menu<?php if(basename($_SERVER["SCRIPT_FILENAME"]) == 'logs'){echo('active');}?>">
                        <a href="logs.php">
                            <div class="">
                                <i class="fa fa-user-secret"></i>
                                <span>Registro de Login</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu single-menu add-menue <?php if(basename($_SERVER["SCRIPT_FILENAME"] , '.php') == 'user'){echo('active');}?>">
                        <a href="user_update.php">
                            <div class="">
                                <i class="fa fa-address-book mr-1"></i>
                                <span>Alterar Usuário e Senha</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu single-menu <?php if(basename($_SERVER["SCRIPT_FILENAME"]) == 'extra'){echo('active');}?>">
                        <a href="suporte.php">
                            <div class="">
                                <img src="img/suporte.png" rel="icon" type="x-icon">
                                <span>suporte</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu single-menu add-menue <?php if(basename($_SERVER["SCRIPT_FILENAME"], '.php') == 'send_message'){echo('active');}?>">
                        <a href="logout.php">
                            <div class="">
                                <i class="fa fa-sign-out mr-1"></i>
                                <span>SAIR</span>
                            </div>
                        </a>
                    </li>
                    <li class="menu single-menu">
                        <a href="#more" data-toggle="collapse" aria-expanded="false" class="dropdown-toggle">
                            <div class="">
                                <i class="fa fa-plus-circle mr-1"></i>
                                <span>Menu</span>
                            </div>
                            <svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" class="feather feather-chevron-down"><polyline points="6 9 12 15 18 9"></polyline></svg>
                        </a>
                        <ul class="collapse submenu list-unstyled" id="more" data-parent="#topAccordion">
                            <li>
                                <a href="user_update.php"><i class="fa fa-address-book mr-1"></i>Alterar Usuário e Senha</a>
                            </li>
                            <li>
                                <a href="logout.php"><i class="fa fa-sign-out mr-1"></i> SAIR </a>
                            </li>
                        </ul>
                    </li>
                </ul>
            </nav>
        </div>
        <!--  END TOPBAR  -->
        
        <!--  BEGIN CONTENT PART  -->
        <div id="content" class="main-content" style="min-height:480px">
            <div class="layout-px-spacing">