Die WinTipps 2001

Apache - apache konfig und downloads

Webmaster - 28.11.2003, 21:45
Titel: RE...
Sodele...

hier mal ein einfaches PHP-Script:
 Code:

<html>
<head>
   <title>Downloads</title>
</head>

<body bgcolor="#000000">

<table align="center" width="90%" cellpadding="3" cellspacing="2"  border="0">
   <tr>
      <td align="center">

<?php

// Verzeichnis in dem die Dateien liegen (relative Pfadangabe zum Script, mit "/" am Ende!)
$download_folder = "./downloads/";

// in das o.g. Verzeichnis wechseln
chdir($download_folder);

$folder = opendir('.');

while( $files = readdir($folder) )
{
   //$total_files = count($bilder); 
   
   if( $files != "." && $files != ".." && !is_dir($files) )
   {
      //$downloads .= "$file\n";
      //$total_files = count($files);
      $total_files = array($files);
      
      reset($total_files);
      
      echo "<table align=\"center\" width=\"100%\" cellpadding=\"5\" cellspacing=\"3\" border=\"0\">";
      echo "<tr>";
      
      while ( list($key, $downloads) = each($total_files) )
      {
         // Download-Pfad
         $filename = "$downloads <br>";
         $path = $download_folder . $downloads;
         
         echo "<td align=\"left\">";
         echo "<a style=\"color: #999999\"; href=\"$path\">$filename</a>";
         echo "</td>";
         echo "</tr>";
         echo "</table>";
      }
   }
}

closedir($folder);

chdir("../");

?>

   </tr>
</table>

</body>

</html>


Speichere diesen Code als download.php ab (darf nicht in dem Ordner liegen, wo auch die Dateien zum Downloaden liegen), und verlinke darauf im Forum...

Das Design musst Du natürlich anpassen.
Alle Zeiten sind GMT + 1 Stunde
Design and Modifications (additional scripting and bug fixes) by TL Networks
Template-Version 2.1.0 © 2002 TL Networks

based on phpBB