<?php $date = date("Y-m-d");
$heure = date("H:i");
$date_lecture =$date . " " . $heure;
$t=explode(":",$heure);
//fonction plage horaire//
$min=$t[1]-20;
if($min<0)
{
$t_min=$t[0]-1;
$min=$min+60;
if($min<10)
{
$min="0".$min;<br /> }<br /> }<br /> else<br /> {<br /> $t_min=$t[0];<br /> }<br /> $tmin= $date." ".$t_min.":".$min;
$sql="SELECT * FROM ".$table." WHERE date_lecture BETWEEN '".$tmin."' AND '".$date_lecture."' ORDER BY date_lecture DESC " ;
$req=mysql_query($sql) or die (mysql_error());
echo "<h3>Ils sont passés durant les 20 dernières minutes :</h3>";
echo "<table width=\"600\"><tr>" ;
echo "<td>Jaquette</td>";
//echo "<td>Artiste</td>";
echo "<td>Musique</td>";
echo "<td>Heure de passage</td>";
echo "</tr>" ;
function cleanvar ($var) {
$var=stripslashes ($var);
return $var;
}
//echo $sql;
while ($d=mysql_fetch_assoc($req))
{
$contenu_du_fichier=$d["date_lecture"];
$heure = substr($contenu_du_fichier,10,6);
$image =cleanvar ($d["image"]);;
$artiste =cleanvar ($d["title"]);
$VALUE['date_lecture'] = $heure;
foreach($VALUE as $key=>$value) {
static $i=0;
if ($d["image"]!=false){
echo "<td><img src='/pochettes/".cleanvar ($d["image"])."' width=\"50\" height=\"50\" //></td>";
}
else
{
echo "<td><img src=\"/pochettes/pas-visuel.jpg\" width=\"50\" height=\"50\" //></td>";
}
echo "<td>";if($i==0){echo "<strong>";}echo $artiste;if($i==0){echo "</strong>";}echo "</td>";
echo "<td>";if($i==0){echo "<strong>";}echo $heure ;if($i==0){echo "</strong>";}echo"</strong></td>";
echo "</tr>" ;
$i++;
}
}
echo "</table>" ;
?>
Voici un exemple de code que je maîtrise. Je modifie du PHP sur des CMS tel que Prestashop, Wordpress, Joomla etc...