<?php
#change localhost to the sql server, user to the correct username, and pass to the correct password
$con = mysql_connect("localhost","purple13_circus","eggandbacon13") or die("Unable to establish a connection to the database.");

#change database to the database name
$database = "purple13_circus";
$db = mysql_select_db("$database") or die("Couldn't select database $database.");

include_once("smilies.php");

echo "<?xml version=\"1.0\" encoding=\"utf-8\"?>\n";
?>
<rss version="2.0">
<channel>
<title>PM Events</title>
<link>http://www.purplemermaid.net/events.php</link>
<description>Upcoming Events for Purple Mermaid Circus</description>
<language>en-us</language>
<generator>PHP/4.3.9</generator>
<?php
$since = time() - 60*60*24; // one day
$board = "circsoc";
$query = "SELECT id,title,summary,details,time,lister FROM events where user='".$board."' and time>".$since." ORDER BY time"; 

$result = mysql_query($query);
while ($row = mysql_fetch_assoc($result))//a loop
{
  $max_length = 50;
  echo "\t<item>\n";
  //echo "\t\t<title>".substr($row[4], 0, 80)."</title>\n";
  echo "\t\t<title>".$row['title']."</title>\n";
  //echo "\t\t<author>".$row['lister']."</author>\n";
  //echo "\t\t<link>http://purplemermaid.net/chat.php#".$row[0]."</link>\n";
  //$des = str_replace("�", "",$row[4]);
  echo "\t\t<description>".$row['summary']."\n".$row['details']."</description>\n";
  echo "\t</item>\n";
}
?>
</channel>
</rss>