<?php
$path = "../";
$dir = opendir($path);
$x=0;
while($a = readdir($dir))
{
if(ereg('.html',$a) or ereg('.php',$a))
{
$files[$x]=$a;
$x++;
}
}
$myfile="../Sitemap.xml";
$write = fopen($myfile,'w') or die("unable to open");
fwrite($write,'<?xml version="1.0" encoding="UTF-8"?><urlset xmlns="http://www.sitemaps.org/schemas/sitemap/0.9">');
$n = "\n";
$timestamp = date("Y/m/d");
for($y=0; $y < sizeof($files); $y++)
{
//\n
$string = "<url><loc>http://www.lyfe.pcriot.com/".$files[$y]."</loc>\n";
fwrite($write,$string);
fwrite($write,'<lastmod>'.$timestamp.'</lastmod>'.$n);
fwrite($write,'<changefreq>weekly</changefreq><priority>0.5</priority></url>');
echo "file: ".$files[$y]."<br>";
}
fwrite($write,'</urlset>\n');