<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN"
        "http://www.w3.org/TR/html4/strict.dtd">
<html lang="fr">
  <head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
    <link rel="stylesheet" type="text/css" href="affiche_liste.css">
    <title>Liste des fichiers</title>
  </head>
  <body>
    <table>
      <caption>Fichiers sur le serveur</caption>
      <tr><th>Titre du fichier</th><th>Type</th><th>Taille</th></tr>
      <?php
        
include "tools.php";
        
        
$cat=fopen($catalogue,"r");
        if(
$cat) {
          while(
$ligne=fgets($cat)) {
            list (
$id,$type,$titre)=entree_catalogue($ligne);
            if(!
file_exists("$repertoire/$id"))
              continue;
            echo 
"<tr><td><a href='download.php?id=$id'>".
                
htmlspecialchars($titre)."</a></td>".
                
"<td>$type</td>".
                
"<td class='taille'>".
                
filesize("$repertoire/$id").
                
"</td>";
          
?>
          <td><form action="supprime.php" method="post">
            <div>
              <input type="hidden" name="id"
                    value="<?= $id ?>">
              <input type="submit" value="Supprimer">
            </div>
          </form></td></tr>
          <?php }
          }
          
fclose($cat);
      
?>  
    </table>
  </body>
  <p><a href="form_upload.html">Uploader un nouveau fichier</a></p>
</html>