Ciao a tutti,
ho realizzato uno script che permette di visualizzare tutti i file in una cartella e altre funzioni.
Vorrei però che non visualizzasse i file con estensione ".mz", purtroppo non ho idea di come fare.

Qualcuno può darmi una mano?
Questo è lo script:

Codice PHP:
$directory "../dir_priv" ;
function 
dir_list($directory FALSE) { 
  
$dirs= array(); 
  
$files = array(); 
  if (
$handle opendir("./" $directory)) { 
    while (
$file readdir($handle)) { 
      if (
is_dir("./{$directory}/{$file}")) { 
        if (
$file != "." $file != ".."$dirs[] = $file
      } else { 
        if (
$file != "." $file != ".."$files[] = $file
     } 
  } 

closedir($handle); 
reset($dirs); 
sort($dirs); 
reset($dirs); 
reset($files); 
sort($files); 
reset($files); 
echo 
"\n

"

while(list(
$key$value) = each($files)) { 
// qui puoi fare l'operazione su "$directory.$value", p.es.: 
   
 
echo"
 <table border='0' cellpadding='5' id='tab_file'> 
  <tr>
  <td width='10%'>"

$path_parts pathinfo($directory.$value);
$ext $path_parts['extension'];
echo 
"
[img]../../img/file_type/"
.$ext.".png[/img]</td>
<td width='20%'>[b]
{$value}[/b]

<p style='color:#666; padding:2px; margin:0;'>"
filesize($directory.$value). " bytes</p>
</td>"
;
echo 
"<td width='30%'>".
$var=fopen("dir_priv/".$value.".mz","r");
$leggi=fread($var,filesize("dir_priv/".$value.".mz"));
$sss=nl2br($leggi);
fclose($var);
echo 
$sss;
"</td>";
  echo
  
"<td width='25%'>";
$path_parts pathinfo($directory.$value);
$ext $path_parts['extension']; 

$ext_insieme = array('com''htm''exe''html' 'shtml' 'php' 'asp' 'ade' 'adp' 'bas' 'bat' 'chm' 'cmd' 'com' 'cpl' 'crt' 'hlp' 'hta' 'inf' 'ins' 'isp' 'js' 'jse' 'lnk' 'mdb' 'mde' 'msc' 'msi' 'msp' 'mst' 'pcd' 'pif' 'reg' 'scr' 'sct' 'shb' 'shs' 'url' 'vb' 'vbe' 'vbs' 'wsc' 'wsf' 'wsh' '286' '386' 'vxd' 'dll' 'ocx' 'vbx' 'drv' 'ovl' 'scf' 'sys' 'qtx' 'fot' 'rom' 'class' 'job' 'htt' 'wll' 'dot' 'wiz' 'xla' 'xll' 'xlt' 'mdt' 'mdz' 'pot' 'ppa' 'wpt' 'wpm' 'mht'); 

if (
in_array($ext$ext_insieme)) { 
    echo 
"<a href='#' class='button'><table border='0' cellpadding='0'>
  <tr>
    <td>[img]../../img/alert.png[/img]</td>
    <td>Il file non è sicuro</td>
  </tr>
</table>
</a>"


else { 
    echo 
"<a href='#' class='button'><table border='0' cellpadding='0'>
  <tr>
    <td>[img]../../img/check.png[/img]</td>
    <td>Il file è sicuro</td>
  </tr>
</table>
</a>"

}  
"</td>";



  
  echo 
"<td width='5%'><a title='Download'  href='force-download.php?file={$directory}{$value}'>
  [img]../../img/download.png[/img]
</a></td>
<td width='5%'>
 <a title='Elimina' href='elimina.php?file=
{$directory}{$value}'> 
[img]../../img/delete.png[/img]
</a> 
</td>
  "
;

 echo

  </tr>
  </table>\n"
; } echo "</p>\n"; } dir_list("dir_priv/");