= 1024) { $filesize = ceil($filesize / 1024); $suffix = " KB"; if($filesize >= 1024) { $filesize = ceil($filesize / 1024); $suffix = " MB"; if($filesize >= 1024) { $filesize = ceil($filesize / 1024); $suffix = " GB"; } } } else { $suffix = " B"; } return $filesize . $suffix; } function convertPerms($perms) { if (($perms & 0xC000) == 0xC000) { // Socket $info = 's'; } elseif (($perms & 0xA000) == 0xA000) { // Symbolic Link $info = 'l'; } elseif (($perms & 0x8000) == 0x8000) { // Regular $info = '-'; } elseif (($perms & 0x6000) == 0x6000) { // Block special $info = 'b'; } elseif (($perms & 0x4000) == 0x4000) { // Directory $info = 'd'; } elseif (($perms & 0x2000) == 0x2000) { // Character special $info = 'c'; } elseif (($perms & 0x1000) == 0x1000) { // FIFO pipe $info = 'p'; } else { // Unknown $info = 'u'; } // Owner $info .= (($perms & 0x0100) ? 'r' : '-'); $info .= (($perms & 0x0080) ? 'w' : '-'); $info .= (($perms & 0x0040) ? (($perms & 0x0800) ? 's' : 'x' ) : (($perms & 0x0800) ? 'S' : '-')); // Group $info .= (($perms & 0x0020) ? 'r' : '-'); $info .= (($perms & 0x0010) ? 'w' : '-'); $info .= (($perms & 0x0008) ? (($perms & 0x0400) ? 's' : 'x' ) : (($perms & 0x0400) ? 'S' : '-')); // World $info .= (($perms & 0x0004) ? 'r' : '-'); $info .= (($perms & 0x0002) ? 'w' : '-'); $info .= (($perms & 0x0001) ? (($perms & 0x0200) ? 't' : 'x' ) : (($perms & 0x0200) ? 'T' : '-')); return $info; } if($_GET['f']) { // The file $filename = $_GET['f']; $percent = 0.2; // Content type header('Content-type: image/png'); // Get new dimensions list($width, $height) = getimagesize($filename); if($width > 90 || $height > 80) { if($width >= $height) { if($width > 90) { $new_width = "90"; $new_height = (($new_width / $width) * $height); } } else { if($height > 80) { $new_height = "80"; $new_width = (($new_height / $height) * $width); } } } else { $new_width = $width; $new_height = $height; } // Resample $image_p = imagecreatetruecolor($new_width, $new_height); imagealphablending($image_p, false); imagesavealpha($image_p, true); $e = $_GET['e']; if($e == '.jpg') { $image = imagecreatefromjpeg($filename); } elseif($e == '.png') { $image = imagecreatefrompng($filename); } elseif($e == '.gif') { $image = imagecreatefromgif($filename); } elseif($e == '.bmp') { $image = imagecreatefromwbmp($filename); } imagecopyresampled($image_p, $image, 0, 0, 0, 0, $new_width, $new_height, $width, $height); // Output imagepng($image_p, NULL, 9); exit; } $d = $_GET['d']; $qstr = $_SERVER['SCRIPT_NAME']; $qtr = explode('/',$qstr); $path = ''; for($i = 0; $i < count($qtr) - 1; $i++) { $path .= $qtr[$i] . '/'; } $thispath = $path; ?>
'.jpg',
'2' => '.png',
'3' => '.gif',
'4' => '.tif',
'5' => '.bmp',
'6' => '.jpeg');
$filet = array('1' => '.7zip',
'2' => '.ace',
'3' => '.ai',
'4' => '.aiff',
'5' => '.asp',
'6' => '.avi',
'7' => '.bat',
'8' => '.bin',
'9' => '.bmp',
'10' => '.ccd',
'11' => '.com',
'12' => '.css',
'13' => '.dll',
'14' => '.doc',
'15' => '.indd',
'16' => '.fla',
'17' => '.gif',
'18' => '.hqx',
'19' => '.htm',
'51' => '.html',
'20' => '.img',
'21' => '.inf',
'22' => '.ini',
'23' => '.iso',
'24' => '.jpg',
'25' => '.mdf',
'26' => '.midi',
'27' => '.mov',
'28' => '.mp3',
'29' => '.mp4',
'30' => '.mpc',
'30' => '.ogg',
'32' => '.pdf',
'33' => '.php',
'34' => '.png',
'35' => '.ppt',
'36' => '.psd',
'37' => '.psp',
'38' => '.rar',
'39' => '.sit',
'40' => '.sitx',
'41' => '.swf',
'42' => '.sys',
'43' => '.tiff',
'44' => '.txt',
'45' => '.wav',
'46' => '.wma',
'47' => '.wmv',
'48' => '.xls',
'49' => '.xml',
'50' => '.zip');
$size = 0;
$bytes = 0;
foreach(glob($d . "*") as $file) {
if(!is_dir($file)) {
$size += filesize($file);
$bytes += filesize($file);
}
}
$d = str_replace("../","",$d);
$d = str_replace("./","",$d);
while(true) {
if(substr($d,0,1) == '/')
$d = substr($d, 1);
else
break;
}
$alt = true;
$size = convertSize($size);
$bytes = number_format($bytes);
$goup = '';
if($d && !empty($d)) {
$arr = explode("/",$d);
for($i = 0; $i < count($arr) - 2; $i++) {
$newdir .= $arr[$i] . '/';
}
$goup = '
Go up';
}
?>
Directory Listing for
Total size: ( bytes)
| ' . $dir . ' | ' . convertSize(filesize($file)) . ' | ' . date("l, F j, Y", filectime($file)) . ' at ' . date("g:i:s A", filectime($file)) . ' | ' . convertPerms(fileperms($file)) . ' | |
| ';
if($isImage) {
echo ' |
' . $filename . ' | ' . convertSize(filesize($file)) . ' (' . number_format(filesize($file)) . ' bytes) |
' . date("l, F j, Y", filectime($file)) . ' at ' . date("g:i:s A", filectime($file)) . ' | ' . convertPerms(fileperms($file)) . ' |