<?php
include("connect.php");

define(RSS_TITLE, "Special Discounts at MalaMaal.com, only available in this RSS");
define(WEBLINK, "http://www.MalaMaal.com");
define(DESCRIPTION, "If you prefer to buy digital products like eBooks and
  Software online, there is some GOOD NEWS for You! MalaMaal.com is
  now offering some fantafabulous Discounts on its eProducts, on a
  Daily Basis! BUT, this Discount is ONLY available through This RSS
  feed, nowhere else! So grab this RSS and keep an eagle's eye on
  whats available for pennies on the dollar! Just in case you didn't
  know, MalaMaal.com has plenty of eProducts like eBooks, Software,
  Recipes, Scripts, Tutorials, How-To Guides, Web Templates, Games and
  scores of other Niche eProducts, at substantial Discounts. Some of
  them also have Resell and Reprint Rights. Categories include Copy
  Writing, Marketing, Search Engine Optimization and Promotion, Web
  Design, Blogging, Hypnosis, Self Improvement, Online Profit,
  Affiliate Marketing, eBay Profits, etc.");
Header("Content-Type: text/xml"); 
echo "<?xml version=\"1.0\"?>";

?>
<rss version="2.0">
<channel>
<title><?php echo RSS_TITLE; ?></title> 
<link><?php echo WEBLINK;?></link> 
<description><?php echo DESCRIPTION; ?></description> 
<language>en-us</language> 
<image>
<url>
http://www.malamaal.com/shop/catalog/images/malamaal.jpg
</url>
<title>MalaMaal.com</title>
<link>http://www.MalaMaal.com</link>
<width>144</width>
<height>47</height>
</image>
<?php

	if($cat == "coupon") {
	$result = mysql_query("select * from coupons where coupon_expire_date >= CURDATE() and coupon_start_date <= CURDATE() and coupon_code like 'rss#%'");
while ($row = mysql_fetch_array($result)) {
	$result1 = mysql_query("select * from coupons_description where coupon_id='$row[coupon_id]'");
	$p_id = explode("#", $row[coupon_code]);
	$row_des = mysql_fetch_array($result1);
	$result2 = mysql_query("select * from products_description where products_id = '$p_id[1]'");
	$row_pro = mysql_fetch_array($result2);
	//$at = htmlentities($row[title]);
	$at = $row_pro[products_name];
  $at = ereg_replace("&", "&amp;", $at);
	$cp_co = base64_encode($row[coupon_code]);
	$cp_co = "http://www.malamaal.com/in/?in=$cp_co";
	$get_con = ereg_replace("&", "&amp;", $row_des[coupon_description]);
?>
<item>
  <title><?php echo $at ?></title> 
  <link><?php echo "$cp_co"; ?></link> 
  <description><?php echo "$get_con"; ?></description> 
  </item>
<?php
}//end while

} //end if
// free resources and close connection
//mysql_free_result($result);
//mysql_close($connection);

?>
</channel>
</rss>
