Tfe

Ongi etorri tfe-ren webgunera...

Old stuff/old_sites/appo/rss2.php

(Deskargatu)
<? header("Content-type: text/xml"); ?>
<? echo '<?xml version="1.0" encoding="iso-8859-15" ?>
<?xml-stylesheet type="text/css" href="rss.css"?>'; ?>

<rss version="2.0">
<?
include("connect.php");

$contenu = array();
$query = "SELECT * from blog ORDER BY id DESC Limit 10";
$result = mysql_query($query) or die();
while ($row = mysql_fetch_assoc($result))
{
    $row['date'] = preg_replace("/(\d{4})(\d{2})(\d{2})(\d{2})(\d{2})(\d{2})/","$1-$2-$3T$4:$5:$6Z",$row['date']);
    $content = array('id'=>$row['id'],'type'=>$row['section'],'date' => $row['date'], 'posteur' => 'appolon' , 'titre' => $row['titre'] , 'contenu' => $row['contenu']);
    array_push($contenu,$content);
}



$jour = date(j);
$jjour = date(D);
$moi = date(M);
$annee = date(Y);
$heure = date(G);
$min = date(i);
$sec = date (s);
 
echo "<channel> 
    <title>Blog</title>
    <description>RSS</description>
    <link>http://blog.indesignstudio.be/blog.php</link>
    <pubDate>$jjour, $jour $moi $annee $heure:$min:$sec +0100</pubDate>
    <lastBuildDate>$jjour, $jour $moi $annee $heure:$min:$sec +0100</lastBuildDate>
    <generator>php</generator>
    <category>blog</category>
    <language>fr-FR</language>
    <webMaster>Amaury@sansinterdit.be</webMaster>
    
";

foreach ($contenu as $key)
{

$key['contenu'] = preg_replace(array("/&/","/</","/>/","/\\x80/"),array("&amp;","&lt;","&gt;"," euros"),$key['contenu']);
ereg("([0-9]{4})\-([0-9]{2})\-([0-9]{2})T([0-9]{2}):([0-9]{2}):([0-9]{2})Z",$key['date'],$regs);
echo "\n
    <item>
    <link>http://blog.indesignstudio.be/blog.php?id=$regs[1]/$regs[2]/$regs[3]/".$key['id']."</link>
    <title>".$key['titre']."</title>
    <pubDate>$regs[3]/$regs[2]/$regs[1] a$regs[4]:$regs[5]/$regs[6]</pubDate>
    <category>".$key['type']."</category>
    <description>".$key['contenu']."</description>
</item>
";
}

echo "
</channel>
</rss>
";    
   

?>