<?php
// XML Sitemap for SUASH Website
header('Content-Type: application/xml; charset=utf-8');

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

// Base URL
$base_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . $_SERVER['HTTP_HOST'];

// Pages with their priorities and update frequencies
$pages = [
    [
        'url' => $base_url . '/home_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'weekly',
        'priority' => '1.0'
    ],
    [
        'url' => $base_url . '/services_new_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.8'
    ],
    [
        'url' => $base_url . '/gallery.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'weekly',
        'priority' => '0.9'
    ],
    [
        'url' => $base_url . '/about_new_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.7'
    ],
    [
        'url' => $base_url . '/contact_new_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.6'
    ],
    [
        'url' => $base_url . '/book_service_clean_fixed.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.8'
    ],
    [
        'url' => $base_url . '/login_new_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.5'
    ],
    [
        'url' => $base_url . '/signup_new_clean.php',
        'lastmod' => date('Y-m-d'),
        'changefreq' => 'monthly',
        'priority' => '0.5'
    ]
];

// Output each page
foreach ($pages as $page) {
    echo '<url>';
    echo '<loc>' . htmlspecialchars($page['url']) . '</loc>';
    echo '<lastmod>' . $page['lastmod'] . '</lastmod>';
    echo '<changefreq>' . $page['changefreq'] . '</changefreq>';
    echo '<priority>' . $page['priority'] . '</priority>';
    echo '</url>';
}

echo '</urlset>';
?>
