<?php
header('Content-Type: application/rss+xml; charset=utf-8');
?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
>
<channel>
	<title>The Gauntlet Heavy Metal News</title>
	<link>http://www.thegauntlet.com</link>
	<description>heavy metal news, tour dates, concert reviews, black metal death metal and festival news</description>
	<copyright>Copyright 2013 The Gauntlet - For Personal Use Only</copyright>
	<language>en-us</language>
<?php
   include ("/var/www/html/common/connectdb.php");
        $result = mysql_query( "SELECT * FROM news WHERE status=1 ORDER BY id DESC LIMIT 0, 1 " );
        while ( $row = mysql_fetch_object( $result ) )
        {  ?>

	<lastBuildDate><?php echo date('r', strtotime($row->dt)); ?></lastBuildDate>
<?php }; ?>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
<image>
	<title>TheGauntlet.com</title>
	<url>http://www.thegauntlet.com/thegauntlet_mini.gif</url>
	<link>http://www.thegauntlet.com</link>
</image>
<?php

	$result = mysql_query( "SELECT * FROM news WHERE status=1 ORDER BY id DESC LIMIT 0, 20 " );
	while ( $row = mysql_fetch_object( $result ) )
	{
	$string = "$row->article_title";
	$string2 = "$row->article_caption";
   $newname = preg_replace("![^a-z0-9]+!i", "-", $string);
	$caption = preg_replace("![^a-z0-9]+!i", "-", $string2);

echo "<item>";
echo "<title>".$string."</title>";
echo "<link>http://www.thegauntlet.com/article/".$row->bid."/".$row->id."/".$newname."</link>";
echo "<guid>http://www.thegauntlet.com/article/".$row->bid."/".$row->id."/".$newname."</guid>";
echo "<description><![CDATA[".$string2."]]></description>";
echo "<category><![CDATA[".$row->tag1."]]></category>";
echo "<category><![CDATA[".$row->tag2."]]></category>";
echo "<category><![CDATA[".$row->tag3."]]></category>";
echo "<pubDate>".date('r', strtotime($row->dt))."</pubDate>";
echo "</item>";
};

echo "</channel>";
echo "</rss>";
?>