The only variable which *must* be specified is $dir, at least you have to use: "./" Version 0.01 - working 0.02 - md5 hash by Oliver Gobin og@ogobin.org www.OGobin.org */ echo "
";

// init:
$i = 0;
$files = array();
$handle = opendir($dir);

// fill the array:
while($file = readdir($handle)) {
  // do not insert '.', '..'and 'index.php'.
  if(($file != ".") && ($file != "..") && ($file != "index.php")) {
    $files[] = $file;
    $i++;
  }
}

// insert '..'
if($flag_parentDir == 1) {
  $files[] = '..';
  $i++;
}

// sort the array:
rsort($files);

// print the array:
for(--$i; $i >= 0; $i--) {
  if(($flag_size == 1) && ($files[$i] != "..")) {
    $file_size = (int) filesize($files[$i]);
    $type = "bytes";
    if($file_size > 99999) {
      $file_size = (int) ($file_size / 1024);
      $type = "KB   ";
      if($file_size > 99999) {
        $file_size = (int) ($file_size / 1024);
        $type = "MB   ";
      }
    }
    echo "[$file_size\t$type] ";
  }
  if(($flag_md5sum == 1) && ($files[$i] != "..")) {
    echo "[". md5_file($files[$i])."] ";
  }
  if($files[$i] == "..") echo "Parent Directory ";
  $link = str_replace(" ", "%20", $files[$i]);
  echo "$files[$i]";
  echo "\n";
}

// clean up:
closedir($handle);
$files = array();
$i = 0;

echo "
\n"; ?>