<?
///////////////////////////////////////////////////////////////////////////////////////
// In the name of God //
// This portal is a private portal And it was writen by Mohsen Davari //
// Please do not change its copyright //
// I hope that you enjoy using my portal //
// If you have any problem contact me with this email => [email protected] //
// Thank`s a lot //
// Bye //
///////////////////////////////////////////////////////////////////////////////////////
header("Content-type: text/xml\n\n");
$site_url="http://$_SERVER[HTTP_HOST]$_SERVER[PHP_SELF]";
$site_url = str_replace ("/need_file/rss.php","",$site_url);
$systemname ="Mohsen davari";
print'<?xml version="1.0" encoding="utf-8" ?>
<rss version="2.0" >
<channel>
<generator>'.$systemname.'</generator>
<language>fa-ir</language>
';
include('../db.php');
switch ($_GET['mode']) {
case("main"):
$limit_max=$_GET['limit_max'];
$p_page=$_GET['p_page'];
$rss_1 = mysql_query("SELECT * FROM posts_posts where `show`='yes' ORDER BY `id` DESC LIMIT $limit_max , $p_page") or die(mysql_error());
while($row = mysql_fetch_array($rss_1)){
$rss_2 = mysql_query("SELECT * FROM posts_cats where `id`='{$row['catid']}'") or die(mysql_error());
$catname = mysql_fetch_array($rss_2);
$title = htmlspecialchars($row['title']);
$content = htmlspecialchars($row['note_main']);
$postlink=''.$site_url.'/index.php?post='.$row['id'].'';
print'
<item>
<title>'.$title.'</title>
<author>'.$row['writer'].'</author>
<category>'.$catname['name'].'</category>
<created>'.$row['y'].'/'.$row['m'].'/'.$row['d'].'</created>
<description>'.$content.'</description>
<link>'.$postlink.'</link>
</item>
';
}
break;
case("cats"):
$catid=$_GET['catid'];
$limit_max=$_GET['limit_max'];
$p_page=$_GET['p_page'];
$rss_1 = mysql_query("SELECT * FROM posts_posts where `show`='yes' AND `catid`='{$catid}' ORDER BY `id` DESC LIMIT $limit_max , $p_page") or die(mysql_error());
while($row = mysql_fetch_array($rss_1)){
$rss_2 = mysql_query("SELECT * FROM posts_cats where `id`='{$row['catid']}'") or die(mysql_error());
$catname = mysql_fetch_array($rss_2);
$title = htmlspecialchars($row['title']);
$content = htmlspecialchars($row['note_main']);
$postlink=''.$site_url.'/index.php?post='.$row['id'].'';
print'
<item>
<title>'.$title.'</title>
<author>'.$row['writer'].'</author>
<category>'.$catname['name'].'</category>
<created>'.$row['y'].'/'.$row['m'].'/'.$row['d'].'</created>
<description>'.$content.'</description>
<link>'.$postlink.'</link>
</item>
';
}
break;
case("post"):
$post_id=$_GET['id'];
$rss_1 = mysql_query("SELECT * FROM posts_posts where `id`='{$post_id}'") or die(mysql_error());
$row = mysql_fetch_array($rss_1);
$rss_2 = mysql_query("SELECT * FROM posts_cats where `id`='{$row['catid']}'") or die(mysql_error());
$catname = mysql_fetch_array($rss_2);
$title = htmlspecialchars($row['title']);
$content = htmlspecialchars($row['note_main']);
$postlink=''.$site_url.'/index.php?post='.$post_id.'';
print'
<item>
<title>'.$title.'</title>
<author>'.$row['writer'].'</author>
<category>'.$catname['name'].'</category>
<created>'.$row['y'].'/'.$row['m'].'/'.$row['d'].'</created>
<description>'.$content.'</description>
<link>'.$postlink.'</link>
</item>
';
break;
}
print'</channel></rss>';
?>