All pastes #290689 Raw Edit

Someone

public php v1 · immutable
#290689 ·published 2006-12-24 07:11 UTC
rendered paste body
<?php$dir = "paste/";$dirlist = getFileList("paste/"); function getFileList($dir)  {    # array to hold return value    $retval = array();    # add trailing slash if missing    if(substr($dir, -1) != "/") $dir .= "/";    # open pointer to directory and read list of files    $d = @dir($dir) or die("getFileList: Failed opening directory $dir for reading");    while(false !== ($entry = $d->read())) {      # skip hidden files      if($entry[0] == ".") continue;      if(is_dir("$dir$entry")) continue;      if(substr($entry,-4)!=".php") continue;      elseif(is_readable("$dir$entry")) { $entry = basename($dir.$entry, ".php");        $retval[] = array(          "name" => "$entry",        );      }    }    $d->close();    return $retval;  }  $i = 0;  echo "<table>\n";  echo "<tr><th>Name</th></tr>\n";  foreach($dirlist as $file)   {    $i++;     if($i > 10)       break;    echo "<tr>\n";    echo "<td><a href=\"paste/{$file['name']}.php\" target=\"_parent\">{$file['name']}</a></td>\n";    echo "</tr>\n";  }  echo "</table>\n\n";?>