1 2 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 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78
|
<?php
$dbhost = "localhost";
$dblogi = "root";
$dbpass = "";
$dbbase = "mabase";
$db = @mysql_connect("$dbhost", "$dblogi", "$dbpass") OR DIE("Désolé, la Base est Down !");
@mysql_select_db("$dbbase",$db) OR DIE;
$query = "SELECT clients.id, clients.pseudo, clients.descriptif, clients.date, clients.mobile, clients.num_tel, categories.nom_cat FROM clients,categories WHERE clients.categorie = categories.id ORDER BY clients.date DESC LIMIT 0,15";
$result = mysql_query ($query) or die("La requette a échouée : ".mysql_error());
$nb_msg = mysql_num_rows($result);
header("Content-Type: text/xml");
$xml = '<'.'?xml version="1.0" encoding="iso-8859-1"?'.'><rss version="2.0"><channel>';
$xml .='<title>News</title>';
$xml .='<link>http://www.monsite.com</link>';
$xml .='<description>Les dernières annonces et modifications !</description>';
$xml .='<managingEditor>info@monsite.com</managingEditor>';
$xml .='<language>fr</language>';
$xml .='<generator>monsite.com</generator>';
$xml .='<copyright>monsite.com</copyright>';
$xml .='<webMaster>monsite</webMaster>';
$xml .='<image><url>http://localhost/monsite/img/logo.jpg</url><link>http://www.monsite.com</link></image>';
while ($msg_data = mysql_fetch_array($result))
{
$dir = "clients/".$msg_data['id']."/galerie/";
// Ouvre un dossier bien connu, et liste tous les fichiers
if (is_dir($dir)) {
if ($dh = opendir($dir)) {
$i = 0;
while (($file = readdir($dh)) !== false && $i < 1) {
if ($file != "." && $file != ".." && $file != "Thumbs.db") {
if ($file != "." && $file != ".." && $file != "Thumbs.db")
$img = '<![CDATA[<a title="'.$msg_data["pseudo"].'" href="http://www.monsite.com/'.$msg_data["pseudo"].'"><img border="0" width="180px" height="240px" src="http://localhost/monsite/'.$dir.$file.'" alt="'.$msg_data["pseudo"].'"/></a>]]></description>';
$i++;
}
}
closedir($dh);
}
}
if (($msg_data['mobile'] == "no") OR ($msg_data['mobile'] == "")) { $titre = $msg_data['pseudo']." - ".$msg_data['num_tel']; } else { $titre = $msg_data['pseudo']." - ".$msg_data['mobile']; }
$xml .='<item>';
$xml .='<author>'.$msg_data['pseudo'].'</author>';
$xml .='<title>'.$titre.'</title>';
$xml .='<link>http://www.monsite.com/'.$msg_data["pseudo"].'</link>';
$xml .='<pubDate>'.$msg_data['date'].' GMT</pubDate>';
$xml .='<guid>http://www.monsite.com/'.$msg_data["pseudo"].'</guid>';
$xml .='<description>';
$xml .= echo $img;
$xml .='</description>';
$xml .='<category>'.$msg_data["nom_cat"].'</category></item>';
}
//mysql_close();
$xml .='</channel></rss>';
echo $xml;
?> |
Partager