<?php
require_once "inc/config.php";
require_once "inc/functions.php";
checkLogin();


?>
<?php include "inc/header.php"; ?>
<?php include "inc/sidebar.php"; ?>

<main class="col-md-9 ms-sm-auto col-lg-10 px-md-4">
  <?php include "inc/topbar.php"; ?>

  <?php 
            showMsg();
            if(!empty($_SESSION['bopage'])) 
            {
                 $page_to_include = $_SESSION['bopage'];
                if(file_exists($page_to_include))
                {
                  include_once  $page_to_include;
                }else
                {
                    $page_to_include = $_SESSION['user']['role'].'_'.$_SESSION['bopage'];
                    if(file_exists($page_to_include))
                    {
                    include_once  $page_to_include;
                    addMsg('error', 'user rule page found');
                    }else{

                    addMsg('debug', $page_to_include.' file not found');
                    addMsg('debug', $page_to_include.' file not found');
                    addMsg('error', 'Requested file not found');

                     showMsg();

                    }
                 }
            }
            
            ?>

</main>

<?php include "inc/footer.php"; ?>
