<?
header("Content-Type: application/xml");
echo "<"."?".'xml version="1.0" ?'.">\n";
echo '<rss version="2.0">';
echo "<channel>";
echo "<title>Blog Quizzes from ToysForYourBlog.com</title>";
echo "<description>Enjoy Blog Quizzes? We have lots of free quizzes you can do and post on your blog.</description>";
echo "<link>http://www.toysforyourblog.com</link>";



 include ("editor/includes.php");

	//Lookup the quiz in the DB
		$q = "SELECT * FROM `quiz` WHERE `Enabled` = '1' ORDER BY CreationDate DESC LIMIT 25";

	// Run query
	$result = mysql_query($q);

	// Display something if there is nothing in the DB
	if (!mysql_numrows($result))
		echo "No quizzes";

	while ($quiz = mysql_fetch_object($result))
	{

		$quizfile = 'quiz/'.$quiz->Id.'/'.ereg_replace("[^A-Za-z0-9_]", "", str_replace(" ", "_", $quiz->Title)).'.php';

		echo "<item>";
		echo "<title>".$quiz->Title."</title>";
		echo "<description>".$quiz->Desc."</description>";
		echo "<link>http://www.toysforyourblog.com/".$quizfile."</link>";

$pubdate = strtotime(str_replace('-','/',$quiz->CreationDate));
$pubdate = date ("D, d M Y H:i:s O", $pubdate);
		echo "<pubDate>$pubdate</pubDate>";
		echo "</item>";
		echo "\n";
	}

echo "</channel>";
echo "</rss>";

?>