<?php
require_once 'config.php';
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">';
echo '<url><loc>https://localadjuster.com/</loc><changefreq>weekly</changefreq><priority>1.0</priority></url>';
echo '<url><loc>https://localadjuster.com/counties</loc><changefreq>weekly</changefreq><priority>0.9</priority></url>';
$counties = db()->query("SELECT slug FROM counties")->fetchAll(PDO::FETCH_COLUMN);
foreach ($counties as $s) {
    echo '<url><loc>https://localadjuster.com/county/' . $s . '</loc><changefreq>weekly</changefreq><priority>0.8</priority></url>';
}
$slugs = db()->query("SELECT slug FROM adjusters WHERE status='active'")->fetchAll(PDO::FETCH_COLUMN);
foreach ($slugs as $s) {
    echo '<url><loc>https://localadjuster.com/listing/' . $s . '</loc><changefreq>monthly</changefreq><priority>0.7</priority></url>';
}
echo '</urlset>';
