All pastes #916644 Raw Edit

Unnamed

public php v1 · immutable
#916644 ·published 2008-02-24 20:48 UTC
rendered paste body
<?php$dir = opendir (dirname(__FILE__));$exclude = array(".", "..");while ($fn = readdir($dir)) {	if ($fn == $exclude[0] || $fn == $exclude[1]) continue;	$array[] = $fn;}sort($array);foreach ($array as $file) {	if (is_dir($file)) {		$dir .= '<p><a href="' . $file . '">' . $file . '</a></p>';	}	else {		$size = filesize($file);		$m = 'B';		if ($size > 1024) {			$size = round($size/1024,2);			$m = 'KB';		} 		elseif ($size > 1024*1024) {			$size = round(($size/1024)/1024,2);			$m = 'MB';		}		$arq .= '<p><a href="' . $file . '">' . $file . '</a> - ' . $size . ' ' . $m . '</p>';	}}echo $dir . $arq;closedir($dir);?>