<?phpheader("Content-Type: text/xml;charset=utf-8");include ('db.php');$yesterday=strtotime('yesterday');$now = date("r"); $section=$_GET['section'];if (!$section) { $head='Top Stories'; } else { $section2=str_replace("_", " ", $section); $head=ucwords($section2); $section="AND tag='".strtolower($section)."'"; }if ($head=='Us News') { $head='US News'; $section="AND tag='US News'"; }?><rss version="2.0"><channel> <title>Scoopr - <?php echo $head; ?></title> <link>http://www.scoopr.net</link> <description>Scoopr gathers news from over 4,000 sources and analyzes them. The articles in this feed are the ones currently getting the most press across the globe.</description> <pubDate><?php echo $now; ?></pubDate> <language>en</language> <image> <title>Scoopr</title> <link>http://www.scoopr.net</link> <url>http://www.scoopr.net/images/logorss.gif</url> </image><?php// Get the hot words from the database.$conn = new db;$conn->connect();$query = "SELECT word, COUNT(*) AS count FROM hotwords WHERE timestamp > '".$yesterday."' ".$section." GROUP BY word ORDER BY count DESC LIMIT 20";$result=mysql_query($query) or die("Error: couldn't execute: ($query)");$conn->close();while($row = mysql_fetch_array($result, MYSQL_ASSOC)) { $word=mysql_escape_string($row['word']); // Get relevant articles for each hot word. $conn = new db; $conn->connect(); $query2 = "SELECT *, MATCH (title, article, tag) AGAINST ('$word') AS score FROM articles WHERE MATCH (title, article, tag) AGAINST ('$word') AND timestamp > '".$yesterday."' LIMIT 1 "; $result2=mysql_query($query2) or die(mysql_error()); $conn->close(); // Display article and link. while($row2 = mysql_fetch_array($result2, MYSQL_ASSOC)) { $id=$row2['id']; $title=htmlentities(strip_tags($row2['title'])); $article=htmlentities(strip_tags($row2['article'])); $pubdate=$row2['pubdate']; $pubdate=date('r', strtotime($pubdate)); }// Check for duplicate $dup++; $i=0; $dupstop=1; while($i <= $dup) { if ($duplicate[$i]==$id) { $dupstop=0; } if ($duplicatetitle[$i]==$title) { $dupstop=0; } $i++; } $duplicate[]=$id; $duplicatetitle[]=$title; if ($dupstop==0) { } else { echo '<item><title>'.$title.'</title><link>http://www.scoopr.net/alpha/?page=showarticle&aid='.$id.'</link><guid>http://www.scoopr.net/alpha/?page=showarticle&aid='.$id.'</guid><pubDate>'.$pubdate.'</pubDate><description>'.$article.'</description></item>'; }} ?></channel></rss>