'."\n"; } function endf() { echo ''."\n"; } function br() { return '
'."\n"; } function img($nr,$border=0) { global $_SERVER; return ''; } function getext($filename) { $f = strrev($filename); $ext = substr($f, 0, strpos($f,".")); return strrev($ext); } function sw($i) { if ($i) return 0; else return 1; } function my_filesize($file,$path="./") { // First check if the file exists. if(!is_file($path.$file)) exit("File does not exist!"); // Setup some common file size measurements. $kb = 1024; // Kilobyte $mb = 1024 * $kb; // Megabyte $gb = 1024 * $mb; // Gigabyte $tb = 1024 * $gb; // Terabyte // Get the file size in bytes. $size = filesize($path.$file); /* If it's less than a kb we just return the size, otherwise we keep going until the size is in the appropriate measurement range. */ if($size < $kb) { return $size." B"; } else if($size < $mb) { return round($size/$kb,2)." KB"; } else if($size < $gb) { return round($size/$mb,2)." MB"; } else if($size < $tb) { return round($size/$gb,2)." GB"; } else { return round($size/$tb,2)." TB"; } } function listdir($dir="./",$toplevel="./",$otherlocation="") { global $_SERVER,$debug,$filetypes, $filter, $sort, $sort_type, $show_filesize; $dir=str_replace('./','/',$dir); $text = ""; if ($dir[strlen($dir)-1] != '/') $dir .= '/'; $path=$toplevel.$dir; $path=str_replace('//','/',$path); $path=str_replace('..','',$path); echo 'You are here: '.$path.'

'; # if ($topdir == "./" ) { # $realdir=str_replace('/./','/',dirname($_SERVER["SCRIPT_FILENAME"])."/".$path); # echo "real path=".$realdir."
"; # } else $realdir="$path"; if ($debug) {f(1); echo br().'$path = '.$path.br().'$dir = '.$dir.br().br(); endf();} $diren=$dir; if (!is_dir("$path")) die(f(2,"#FF0000")."Error $path is not a directory?"); $files = dir($path) or die("Error reading/opening $path"); while ($a = $files->read()) { if (!empty($a)) $currentArray[] = $a; } if ($sort && (!$sort_type)) sort($currentArray); if ($sort && $sort_type) sort($currentArray,$sort_type); for ($i = 0; $i < count($currentArray); $i++) { $current = $currentArray[$i]; if (($current != "..") && ($current != ".")) { $dir = $diren; # echo "
if (is_dir(".$path.$current."))
"; if (is_dir($path.$current)) if ($debug) echo "\$dir = $dir - "; if (is_dir($path.$current)) echo '' .img(1).' '."\n" .'' .$current.''.br(); else { if ($toplevel == "./") $dir = $path; if ($debug) echo "\$dir = $dir - "; $match = sw($filter); if (!empty($filetypes[0])) { $ext=getext($current); $match = $filter; for ($e=0;$e'.$current.''; if ($show_filesize) echo " (".my_filesize($current,$realdir).")"; echo br(); } } } }; } f(2); echo ' FileStruct '; echo ''.img(2).' '; echo 'Go to top'.br(); if (empty($topdir)) $topdir = "./"; if ($debug) { f(1); echo "listdir($dir,$topdir,$otherlocation);".br().br(); endf(); } f(2); listdir($dir,$topdir,$otherlocation); endf(); echo '

NewsLetter v'.$ver.'
'; ?>