<?php

require "db.php";

header("Content-Type: application/xml; charset=utf-8");

echo '<?xml version="1.0" encoding="UTF-8"?>';

?>

<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">

<url>
<loc>https://sonoanorma.it/</loc>
<changefreq>weekly</changefreq>
<priority>1.0</priority>
</url>

<url>
<loc>https://sonoanorma.it/verifica/</loc>
<changefreq>weekly</changefreq>
<priority>0.8</priority>
</url>

<?php

$stmt = $mysqli->query("
SELECT public_id
FROM sites
WHERE public_id IS NOT NULL
");

while($row = $stmt->fetch_assoc()){

$url = "https://sonoanorma.it/verifica/?site=".$row['public_id'];

?>

<url>
<loc><?php echo $url; ?></loc>
<changefreq>monthly</changefreq>
<priority>0.7</priority>
</url>

<?php } ?>

</urlset>