<?php require_once '../includes/main.php'; logged_in('admin'); ?>
<?php require_once 'elements/head.php'; ?>

<?php $section = isset($_GET['section']) ? $_GET['section'] : 'category'; ?>

<?php 

$id = (int)$_GET['id'];
$sql = "SELECT * FROM categories WHERE id = '{$id}' LIMIT 1";
if(fetch_rows($sql) < 1){

   $_SESSION['messages'][] = "Category could not be found";
   header("Location: ".URL.'admin/settings/categories');
   exit;

}else{

   $x = fetch_records($sql);

}

?>

<title><?php echo $set['website_name']; ?>: Edit <?php echo ucwords($section); ?>: #<?php echo $id; ?></title>

<meta name="robots" content="noindex">

</head>

<body>

<?php include_once 'elements/header.php'; ?>

<!-- CONTENT -->
<main class="Content">

    <?php include_once 'elements/sidebar/settings.php'; ?>

    <?php 
    
        switch($section){

            case 'category':
                include_once 'sections/edit/category.php';
                break;
                
            default:
                include_once 'sections/edit/category.php';
                break;

        }
    
    ?>

</main>
<!-- CONTENT -->

<?php include_once 'elements/footer.php'; ?>

</body>
</html>
