<?php
$root = $_SERVER['DOCUMENT_ROOT'];
include($root . '/scripts/dbconnect.php');

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

?>

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

<url>
	<loc>http://digitalinfo.org/</loc>
	<lastmod><?php echo date('Y-m-d'); ?></lastmod>
	<changefreq>daily</changefreq>
	<priority>1.0</priority>
</url>




<?
  /* Insert pages into sitemap */
$results = mysql_query("SELECT identifier,sitemap,sitemappriority, DATE_FORMAT(updated, '%Y-%m-%d') AS lastmod FROM pages WHERE released = 'Y' AND sitemap = 'Y' ORDER BY sitemappriority DESC,pageid ASC", $mysql_link)
	or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
	printf("<url>\n\t<loc>http://digitalinfo.org/%s</loc>\n\t<lastmod>%s</lastmod>\n\t<changefreq>weekly</changefreq>\n\t<priority>%s</priority>\n</url>\n\n\n\n", $row['identifier'], $row['lastmod'], ($row['sitemappriority']) ? $row['sitemappriority'] : '0.5');
	
	}



  /* Insert posts into sitemap */
$results = mysql_query("SELECT postid,seostring, DATE_FORMAT(posteddate, '%Y-%m-%d') AS lastmod FROM posts WHERE released = 'Y' ORDER BY posteddate DESC", $mysql_link)
	or die(mysql_error());
while ($row = mysql_fetch_array($results)) {
	printf("<url>\n\t<loc>http://digitalinfo.org/notebook/%s/%s</loc>\n\t<lastmod>%s</lastmod>\n\t<changefreq>monthly</changefreq>\n\t<priority>0.5</priority>\n</url>\n\n\n\n", $row['postid'], $row['seostring'], $row['lastmod']);
	
	}
?>

</urlset>

