<?php require_once("../../resources/config.php"); ?>

<?php include(TEMPLATE_BACK . "/header.php"); ?>

<?php

if (!isset($_SESSION['admin_username'])) {

    redirect("../../public/admin_login.php");
}

?>

<div id="page-wrapper">

    <div class="container-fluid">



        <?php
        //echo $_SERVER["REQUEST_URI"]; displays the relative path /ecom/public/admin/
        if ($_SERVER["REQUEST_URI"] == "/ecom/public/admin/" || $_SERVER["REQUEST_URI"] == "/ecom/public/admin/index.php") {
            include(TEMPLATE_BACK . "/admin_content.php");
        }

        if (isset($_GET['orders'])) {
            include(TEMPLATE_BACK . "/orders.php");
        }

        if (isset($_GET['products'])) {
            include(TEMPLATE_BACK . "/products.php");
        }

        if (isset($_GET['add_product'])) {
            include(TEMPLATE_BACK . "/add_product.php");
        }

        if (isset($_GET['categories'])) {
            include(TEMPLATE_BACK . "/categories.php");
        }

        if (isset($_GET['add_category'])) {
            include(TEMPLATE_BACK . "/categories.php");
        }

        if (isset($_GET['edit_product'])) {
            include(TEMPLATE_BACK . "/edit_product.php");
        }

        if (isset($_GET['admins'])) {
            include(TEMPLATE_BACK . "/admins.php");
        }

        if (isset($_GET['add_admin'])) {
            include(TEMPLATE_BACK . "/add_admin.php");
        }

        if (isset($_GET['edit_user'])) {
            include(TEMPLATE_BACK . "/edit_user.php");
        }

        if (isset($_GET['reports'])) {
            include(TEMPLATE_BACK . "/reports.php");
        }

        ?>

    </div>
    <!-- /.container-fluid -->

</div>
<!-- /#page-wrapper -->

<?php include(TEMPLATE_BACK . "/footer.php"); ?>