<?php header('Content-Type: application/rss+xml');
$yes = mktime(0, 0, 0, date("m"), date("d")-1, date("Y"));
$builddate=date('D, d M Y H:i:s', $yes).' GMT';
$baseurl="http://www.freetipsandwits.com/money-making-tips";
$desc = "Our free downloadable money making courses and expert money making tips will teach you how to make money online. You will learn how to successfully build and run your own online work at home business.";
$copyright="Copyright 2006 Freetipsandwits.com";
?>
<? echo '<?xml version="1.0" encoding="iso-8859-1"?>';?>
<rss version="2.0">
<channel>
<title>Expert Money Making Tips from Freetipsandwits.com</title>
<link><?=$baseurl;?>/</link>
<description><?=$desc;?></description>
<copyright><?=$copyright;?></copyright>
<lastBuildDate><?=$builddate;?></lastBuildDate>
<language>en-us</language>
<?php
require ($_SERVER['DOCUMENT_ROOT'] . '/db/connect.php');
$q="SELECT id,category,title,body,entry_date FROM tips WHERE category='me' ||  category='am' ||  category='hw' || category='se' || category='wb' || category='wp' ORDER BY id DESC";
$result=mysql_query($q);

while($row = mysql_fetch_array($result, MYSQL_NUM))
{
list($id,$category,$title,$body,$entry_date) = $row;
$entry_date="-$entry_date";
$var=explode("-",$entry_date);
$y=$var[1];
$m=$var[2];
$d=$var[3];
$pubdate=mktime(0, 0, 0, date($m), date($d), date($y));
$pubdate=date('D, d M Y H:i:s', $pubdate).' GMT';
$body=strip_tags($body);
$body=str_replace(" - ","... ",$body);
$body=substr($body, 0, 150);
$body="$body...";

if($category=='me')
$sublink="money-making-experts";
if($category=='am')
$sublink="affiliate-marketing-tips";
if($category=='hw')
$sublink="internet-marketing-tips";
if($category=='wb')
$sublink="website-building-tips-tutorials";
if($category=='se')
$sublink="search-engine-optimization-tips";
if($category=='am')
$sublink="website-promotion-tips";
?><item>
      <title><?=htmlentities(strip_tags($title)); ?></title>
      <link><?=$baseurl;?>/<?=$sublink;?>/<?=$id;?>/</link>
      <guid><?=$baseurl;?>/<?=$sublink;?>/<?=$id;?>/</guid>
      <description><![CDATA[<?=$body;?>]]></description>
  </item>
<? }
mysql_close($dbh);
?>
</channel>
</rss>
