Re: [CBLX] cacher plusieurs fichiers en ligne

[ Thread Index | Date Index | More lists.tuxfamily.org/carrefourblinux Archives ]


Salut Manu:

On Wed, Jun 02, 2010 at 01:13:22PM +0200, Emmanuel COUTRIS wrote:
> Salut Aldo, Guillaume et tous,
> 
> On Tue, Jun 01, 2010 at 10:49:15PM +0200, Guillaume GOURDIER wrote:
> > re aldo,
> 
> >
> > From: "Aldo" <info@xxxxxxxxxxxx>
> > Sent: Tuesday, June 01, 2010 8:28 PM
> > To: <carrefourblinux@xxxxxxxxxxxxxxxxxxx>
> > Subject: Re: [CBLX] cacher plusieurs fichiers en ligne
> >
> >>
> >> On Tue, Jun 01, 2010 at 05:11:16PM +0200, Guillaume GOURDIER wrote:
> >>> Dans ce cas, la fonction preg_match devrait pouvoir t'être utile.
> >>> http://us2.php.net/manual/fr/function.preg-match.php
> >>
> >> J'ai l'impresion que c'est preg_match_all qui me conviendrait,
> >> genr que tous les fichiers .jpg ou .JPG ne peuvenet pas être affichés (ou
> >> sont cachés).
> Ce qu'il te faut, c'est la fonction fnmatch (plus simple que
> preg_match car réservé à la comparaison selon les patterns shell et
> non POSIX ou PERL). Donc tu as juste à ajouter dans tes conditions:
> && !fnmatch("DSC_*.JPG",$ligne)

Si j'oublies pas de refermer le if( par un ) derrière ton dernier ) ça
marche nickel!

Merci bcp,

En guise de template/preuve, revoici l'index.ph en pj.

Encore thanx,

Aldo.

<?php
$rep = dirname(__FILE__);
$tb_rep = array();

if($rep_handle = opendir("$rep")) 
{
while (false !== ($ligne = readdir($rep_handle)))
{
if($ligne != "." && $ligne != ".." && $ligne != "style.css" 
&& $ligne != "index.php" && $ligne != ".htaccess"
&& $ligne != "tmp" && $ligne != "orig_door_Etienne_Demeyer" 
&& !fnmatch("DSC_*.JPG",$ligne))
{
$tb_rep[$ligne]['taille'] = filesize($ligne);
$tb_rep[$ligne]['date_c'] = filectime($ligne);
$tb_rep[$ligne]['date_m'] = filemtime($ligne);
$tb_rep[$ligne]['date_a'] = fileatime($ligne);
}
}
closedir($rep_handle);
}
//print_r($tb_rep);
foreach($tb_rep as $key => $ligne)
{
$nom[$key] = $key;
$taille[$key] = $ligne['taille'];
$date_c[$key] = $ligne['date_c'];
$date_m[$key] = $ligne['date_m'];
$date_a[$key] = $ligne['date_a'];
}
array_multisort($nom, SORT_ASC, SORT_STRING, $taille, $date_c, $date_m, 
$date_a);
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html lang="en-US">
<head>
<base href="http://50ste.nietteke.be/";>
<meta http-equiv="content-type" content="text/html; charset=iso-8859-1">
<meta name="author" content="OSvaLdo:~# La Rosa">
<meta name="keywords" content="verjaardagsfotos">
<meta name="description" content="Anita's Verjaardagalbum Home Page">
<link href="style.css" rel="stylesheet" type="text/css" title="default">
<title> Index van http://50ste.nietteke.be/ </title>
</head>
<body>

<center><big><b>Anita&#39;s 50ste <i>MEGA</i> VerjaardagsFeest<br>
DE Fotos!</b></big></center><br><br>

<?php
//echo "<h1> Index van $rep</h1>\n";
echo "<h1> Index van 50ste.nietteke.be </h1>\n";
?>
<table>
<th>Type</th>
<th>Naam</th>
<th>Grootte</th>
<th>Gemaakt</th>
<th>Gewijzigd</th>
<th>Laatst bekeken</th>
<?php
foreach($nom as $value)
{
$tmp = $value;
$ch="<td> - </td>\n";
if($value == "..") $value = "Parent directory";
if(is_dir($value) || $tmp == "..")
$type = "D";
else
$type = "F";
echo "<tr>\n";
echo "<td>$type</td>\n";
echo "<td><a href=\"$tmp\">$value</a></td>\n";
if($tmp == "..")
echo $ch;
else
echo "<td align=right>".$taille[$value]." bytes</td>\n";
if($tmp == "..")
echo $ch;
else
echo "<td>".date("d/m/Y H:i:s", $date_c[$value])."</td>\n";
if($tmp == "..")
echo $ch;
else
echo "<td>".date("d/m/Y H:i:s", $date_m[$value])."</td>\n";
if($tmp == "..")
echo $ch;
else
echo "<td>".date("d/m/Y H:i:s", $date_a[$value])."</td>\n";
echo "</tr>\n";
}
?>
</table>
<hr>
</body>
</html>


Mail converted by MHonArc 2.6.19+ http://listengine.tuxfamily.org/