<?php
header('Content-Type: text/xml; charset=UTF-8');
$base = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . '://' . ($_SERVER['HTTP_HOST'] ?? 'localhost');
$date = date('Y-m-d');
echo '<?xml version="1.0" encoding="UTF-8"?>';
?>
<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">
    <url>
        <loc><?php echo htmlspecialchars($base . '/', ENT_XML1, 'UTF-8'); ?></loc>
        <lastmod><?php echo $date; ?></lastmod>
        <changefreq>weekly</changefreq>
        <priority>1.0</priority>
    </url>
    <url>
        <loc><?php echo htmlspecialchars($base . '/terms', ENT_XML1, 'UTF-8'); ?></loc>
        <lastmod><?php echo $date; ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.3</priority>
    </url>
    <url>
        <loc><?php echo htmlspecialchars($base . '/privacy', ENT_XML1, 'UTF-8'); ?></loc>
        <lastmod><?php echo $date; ?></lastmod>
        <changefreq>monthly</changefreq>
        <priority>0.3</priority>
    </url>
</urlset>
