<?php
header("Content-Type: application/xml; charset=utf-8");

$domain = "https://www.vikingautomotive.com";

// Folder scan (saare .php files auto uthayega)
$files = glob("*.php");

echo '<?xml version="1.0" encoding="UTF-8"?>';
echo '<urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">';

foreach ($files as $file) {

    // index.php ko homepage treat karo
    if ($file == "index.php") {
        $url = $domain . "/";
        $priority = "1.0";
    } else {
        $url = $domain . "/" . str_replace(".php", "", $file);
        $priority = "0.8";
    }

    $lastmod = date("Y-m-d", filemtime($file));

    echo "<url>
            <loc>$url</loc>
            <lastmod>$lastmod</lastmod>
            <priority>$priority</priority>
          </url>";
}

echo '</urlset>';
?>