<?php
  header("Content-type: application/xml"); 
  require 'dbr.php';

function cc_replace($in) {
       for ($i = 0; $i <= 31; $i++) {
         $from  .= chr($i);
         $to    .= ".";
       }
      return strtr($in, $from, $to);
}

function my_remove($string, $new=" ", $black="#")
{
  $my_set='abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ1234567890.,?!-()';
  $first = strtr( $string, $my_set, str_repeat($black, strlen($my_set)) );
  $second = strtr( $string, $first, str_repeat($new, strlen($first)) );
  return $second;
};

  $query = "SELECT * FROM adfnews ORDER BY artid DESC LIMIT 15";
  // process the query and put the results in variables
  $result=mysql_query($query) or die ("*** database error or bad query: ".$query);

// rss header
  echo "<?xml version=\"1.0\"?>\n";
  echo "<rss version=\"2.0\">\n";
  echo "  <channel>\n";
  echo "    <title>JuRg's ADF news</title>\n";
  echo "    <link>http://www.nothingless.org/adf/news.php</link>\n";
  echo "    <description>Asian Dub Foundation related headlines from JuRg's ADF discography site.</description>\n";
  echo "    <language>en-us</language>\n";
  
// loop to process each item
  while ($row=mysql_fetch_row($result)) {
    $id=$row[0];
    $title=stripslashes($row[1]);
    $comment=stripslashes($row[2]);
    $posteddate=$row[3];
 
    echo "    <item>\n";
    echo "      <title>".my_remove(strip_tags($title))."</title>\n";
    echo "      <link>http://www.nothingless.org/adf/newsarticle.php?num=".$id."</link>\n";
    echo "      <description>".my_remove(strip_tags($comment))."</description>\n";
    echo "    </item>\n";
  }

// close rss channel/feed
  echo "  </channel>\n";
  echo "</rss>\n";

?>

