| 12
 3
 4
 5
 6
 7
 8
 9
 10
 11
 12
 13
 14
 15
 16
 17
 18
 19
 20
 21
 22
 23
 24
 25
 26
 27
 28
 29
 30
 31
 32
 33
 34
 35
 36
 37
 38
 39
 40
 41
 42
 43
 44
 45
 46
 47
 48
 49
 
 | <?php                                                       
require("admin/conf.php");
$serveur="$host";
$utilisateur="$user";
$motdepasse="$mdp";
$database="$user";
 
mysql_connect($serveur,$utilisateur,$motdepasse) or die();
mysql_select_db($database);
 
$query = "SELECT * FROM br_news ORDER BY id DESC";
$result = mysql_query ($query) or die(.mysql_error());
 
Header("content-type: text/xml");
 
$xml = '<'.'?xml version="1.0" encoding="UTF-8"?'.'><rss version="2.0"><channel>';
 
$xml .='<title>Champ-Lan flux RSS</title>';
 
while ($msg_data = mysql_fetch_array($result))
{
$id = $msg_data['id'];
 
$titre = $msg_data['titre']." - Nouvelle Du Site";
$news = stripslashes(trim($msg_data['news']));
$news = str_replace("<BR>",'<BR/>',$news);
$news = str_replace("&",'&',$news);
$news = str_replace("<","<",$news);
$news = str_replace(">",">",$news);
 
$xml .='<item>';
$xml .='<title>'.$titre.'</title>';
$xml .='<link>http://champ.lan.free.fr/news.php?id='.$id.'</link>';
$xml .='<pubDate>'.$msg_data['timestamp'].' GMT</pubDate>';
$xml .='<guid>http://champ.lan.free.fr/news.php?id='.$id.'</guid>';
$xml .='<description>';
 
$xml .= $news; 
 
$xml .='</description></item>';
}
 
mysql_close();
 
$xml .='</channel></rss>';
 
echo $xml;
 
?> | 
Partager