<?
  $myDir = opendir("$exportpath/bestelllisten");
  $files = array();
  while ($filename = readdir($myDir))
  {
      if (filetype("$exportpath/bestelllisten/$filename") == "file")
     {
          array_push($files, $filename);
      }
  }
  closedir($myDir);
?>
<?
  if ($files)
  {
    ?>
             <form action="<?=$_SERVER['PHP_SELF']?>" method="POST">
                  <fieldset class="fieldset"><legend>Exportierte Dateien</legend>
                    Folgende Dateien <?=$action=='u18'?'(U18)':''?> stehen zum Herunterladen bereit:<br><br>
                    <input type="hidden" name="submit" value="submit" />
                    <input type="hidden" name="module" value="<?=$module?>" />
                    <input type="hidden" name="action" value="delete" />
                    <table>
<?
  foreach($files as $file)
  { ?>

                      <tr>
                        <td>
<? $server = $_SERVER['HTTP_HOST'];
   $proto = preg_match('/^https/',$_SERVER['SCRIPT_URI'])?'https':'http';
 ?>
                          <a href="<?=$proto?>://<?=$server?><?=$rooturl?>admin/downloadcsv.php?file=bestelllisten/<?=$file?>"><?=$file?></a> <!-- (<?=$lines?> Eintr&auml;ge) -->


                        </td>
                        <td>
                          <input class="inputradio" type="checkbox" name="deletefiles[]" value="<?=$file?>" title="Datei zum L&ouml;schen markieren" />
                        </td>
                      </tr>
<? } ?>
                    </table>
                    <input type="submit" name="delete" class="inputsubmit" value="Dateien l&ouml;schen" /><br />
                  </fieldset>
                </form>
<? }  else { ?>
<? } ?>

             <form enctype="multipart/form-data" action="<?=$_SERVER['PHP_SELF']?>" method="POST">
                  <fieldset class="fieldset"><legend>Versandbest&auml;tigung importieren</legend>
                    <input type="hidden" name="submit" value="submit" />
                    <input type="hidden" name="module" value="<?=$module?>" />
                    <input type="hidden" name="action" value="import" />
                    
                    <input type="file" name="uploadfile" /><br/>
                    <input type="submit" name="upload" class="inputsubmit" value="Datei hochladen" /><br />
                  </fieldset>
                </form>
