rendered paste body<?php
//debut du chrono
$temps = microtime ();
$temps = explode (" ", $temps);
$temps = $temps[1] + $temps[0];
$chrono_start = $temps;
//si le parametre indiquant la categorie est bien présent et est bien un chiffre
if (!isset($_GET['cat']) OR !is_numeric($_GET['cat'])) {echo " catégorie non définie ou argt non numérique !"; exit();}
//include 'inc/fonctions.php';
$cat = $_GET['cat'];
//requete mysql detail categorie
include "inc/mysql-connect.php";
$sql = 'SELECT nom FROM categories WHERE id='.$cat;
$req = mysql_query($sql) or die('Erreur SQL !<br>'.$sql.'<br>'.mysql_error());
while($data = mysql_fetch_assoc($req))
{
echo '<h1>'.$data['nom'].'</h1>';
}
// on ferme la connexion à mysql
mysql_close();
// CONFIGURATION //
$feed_url = 'http://www.dailymotion.com/rss/bookmark/humour_is_free_'.$cat;
$thumbnail = '320x240'; // Taille des vignettes : "320x240" ou "160x120"
// Chargement du flux...
if($xml = simplexml_load_file($feed_url)) {
$xml = $xml->channel;
foreach($xml->item as $item) {
$title = $item->title;
$swf = $item->children('http://search.yahoo.com/mrss');
$swf = $swf->group->children('http://search.yahoo.com/mrss');
$swf = $swf[3]->attributes();
$swf = $swf->url;
$thumbnail_url = $item->children('http://search.yahoo.com/mrss');
$thumbnail_url = $thumbnail_url->thumbnail->attributes();
if($thumbnail != '320x240') $thumbnail_url = str_replace('320x240', $thumbnail, $thumbnail_url);
?>
<div class="post">
<div class="title"><?php echo $title;?></div>
<div class="video">
<?php
echo $swf;
echo '<a href="video.php?video=#" title="Regarder '.$title.'"><br/><img src="'.$thumbnail_url.'" alt="'.$title.'" /><div class="lien">Lien</div></a>';
?>
</div>
</div>
<?php
}
}
// Si erreur lros du chargement, affichage...
else{
echo '<strong>Impossible de charger le flux '.$feed_url.'.</strong>';
}
//fin chrono
$temps = microtime ();
$temps = explode (" ", $temps);
$temps = $temps[1] + $temps[0];
$chrono_finish = $temps;
$temps_generation = $chrono_finish - $chrono_start;
echo 'Page générée en '.number_format ($temps_generation, 4,',','').' s';
?>