1 |
aurelien |
1 |
<?php
|
|
|
2 |
|
|
|
3 |
include("connect.php");
|
|
|
4 |
|
|
|
5 |
|
|
|
6 |
$rss = "<?xml version=\"1.0\" encoding=\"iso-8859-1\"?> \n";
|
|
|
7 |
$rss .= "<rss version=\"0.91\" xmlns:dc=\"http://purl.org/dc/elements/1.1/\">\n";
|
|
|
8 |
$rss .='
|
|
|
9 |
<channel>
|
|
|
10 |
<title>Observatoire des saisons</title>
|
|
|
11 |
<link>http://www.obs-saisons.fr</link>
|
|
|
12 |
<description>Observatoire des saisons</description>
|
|
|
13 |
<language>fr</language>';
|
|
|
14 |
|
|
|
15 |
|
|
|
16 |
$query = "select distinct MESURE.SEQUENCE_ID, MESURE.MESURE_ID, ".
|
|
|
17 |
"EXTRACT(YEAR from MESURE_DATE), ".
|
|
|
18 |
"DATE_FORMAT(MESURE_DATE,'%d/%m/%Y') AS DATE_MESURE, EVENEMENT_NOM, NULL, ".
|
|
|
19 |
"ESPECE_NOM_SCIENTIFIQUE, ESPECE_NOM_VERNACULAIRE, STATION_NOM, STATION_LATITUDE, ".
|
|
|
20 |
"STATION_LONGITUDE, STATION_ALTITUDE, ENVIRONNEMENT_NOM, ".
|
|
|
21 |
"SEQUENCE.PARTICIPANT_ID, PARTICIPANT_NOM, PARTICIPANT_PSEUDO ".
|
|
|
22 |
"from MESURE, SEQUENCE, EVENEMENT, ESPECE, STATION, ENVIRONNEMENT, PARTICIPANT ".
|
|
|
23 |
"where MESURE.SEQUENCE_ID=SEQUENCE.SEQUENCE_ID ".
|
|
|
24 |
"and SEQUENCE.ESPECE_ID=ESPECE.ESPECE_ID ".
|
|
|
25 |
"and MESURE.EVENEMENT_ID=EVENEMENT.EVENEMENT_ID ".
|
|
|
26 |
"and STATION.STATION_ID=SEQUENCE.STATION_ID ".
|
|
|
27 |
"and PARTICIPANT.PARTICIPANT_ID=SEQUENCE.PARTICIPANT_ID ".
|
|
|
28 |
"and ENVIRONNEMENT.ENVIRONNEMENT_ID=SEQUENCE.ENVIRONNEMENT_ID ORDER BY MESURE_DATE DESC LIMIT 50";
|
|
|
29 |
|
|
|
30 |
|
|
|
31 |
|
|
|
32 |
|
|
|
33 |
$res = mysql_query($query);
|
|
|
34 |
|
|
|
35 |
|
|
|
36 |
|
|
|
37 |
while ($row =mysql_fetch_array($res)) {
|
|
|
38 |
$row['ESPECE_NOM_SCIENTIFIQUE'] = htmlspecialchars($row['ESPECE_NOM_SCIENTIFIQUE']);
|
|
|
39 |
$row['ESPECE_NOM_VERNACULAIRE'] = htmlspecialchars($row['ESPECE_NOM_VERNACULAIRE']);
|
|
|
40 |
$row['DATE_MESURE'] = htmlspecialchars($row['DATE_MESURE']);
|
|
|
41 |
$row['PARTICIPANT_PSEUDO'] = htmlspecialchars($row['PARTICIPANT_PSEUDO']);
|
|
|
42 |
$row['STATION_NOM'] = htmlspecialchars($row['STATION_NOM']);
|
|
|
43 |
|
|
|
44 |
$rss.= ' <item>
|
|
|
45 |
<title>'.$row['ESPECE_NOM_VERNACULAIRE'] . ' par ' . $row['PARTICIPANT_PSEUDO'].'</title>
|
|
|
46 |
<author>'.$row['PARTICIPANT_PSEUDO'].'</author>
|
|
|
47 |
<link>http://www.obs-saisons.fr/</link>
|
|
|
48 |
<description>'.$row['ESPECE_NOM_VERNACULAIRE'] . ' saisi le ' .$row['DATE_MESURE'] . ' par ' . $row['PARTICIPANT_PSEUDO'] ." observe à " . $row['STATION_NOM'] .
|
|
|
49 |
'</description>
|
|
|
50 |
<dc:format>text/html</dc:format>
|
|
|
51 |
</item>';
|
|
|
52 |
|
|
|
53 |
|
|
|
54 |
|
|
|
55 |
}
|
|
|
56 |
|
|
|
57 |
$rss.= '</channel> </rss>';
|
|
|
58 |
|
|
|
59 |
|
|
|
60 |
header("Content-Type: text/xml; charset=ISO-8859-1");
|
|
|
61 |
print $rss;
|
|
|
62 |
exit;
|
|
|
63 |
|
|
|
64 |
?>
|