<?php
// Show ALL errors including fatal
error_reporting(E_ALL);
ini_set('display_errors', 1);

session_start();

require '../../config.php';
require '../admin_config.php';
require '../functions.php';
require '../views/header.view.php';

if (isset($_SESSION['user_email'])){

$connect = connect($database);
if(!$connect){
    die("DB failed");
}

$check_access = check_access($connect);

if ($check_access['user_role'] == 1){
    
    // Set minimal variables
    $totalPages = 8;
    $totalPosts = 2;
    $totalStores = 0;
    $totalCoupons = 0;
    $totalUrls = 10;
    $robotsContent = "User-agent: *\nAllow: /";
    
    echo "<h1>Testing sidebar.php inclusion...</h1>";
    
    try {
        require '../views/sidebar.php';
        echo "<p>Sidebar loaded successfully!</p>";
    } catch (Exception $e) {
        echo "<p>Error loading sidebar: " . $e->getMessage() . "</p>";
    }
    
    echo "<hr><p>Now testing the full view...</p>";
    require '../views/seo_tools.view.php';
	
}else{
	echo "Not admin";
}

require '../views/footer.view.php';

}else{
	echo "Not logged in";
}

?>
