<?php
header("Content-Type: application/xml; charset=utf-8");
include 'config.php';

$base_url = "https://serverp3d.xyz/"; // Sesuaikan dengan domain kamu

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

// Ambil semua slug produk dari database
$query = mysqli_query($conn, "SELECT slug, created_at FROM fashion_products ORDER BY id DESC");

while($row = mysqli_fetch_assoc($query)) {
    echo '<url>';
    echo '<loc>' . $base_url . $row['slug'] . '</loc>';
    echo '<lastmod>' . date('Y-m-d', strtotime($row['created_at'])) . '</lastmod>';
    echo '<changefreq>weekly</changefreq>';
    echo '<priority>0.8</priority>';
    echo '</url>';
}

echo '</urlset>';
?>