'Video File', 'avi' => 'Video File', 'bat' => 'Batch File', 'css' => 'Cascading Style Sheet', 'exe' => 'Executable', 'fla' => 'Flash File', 'swf' => 'SWF Flash File', 'gif' => 'GIF Image', 'dir' => 'Director File', 'html' => 'HTML File', 'htm' => 'HTM File', 'inc' => 'Include File', 'jpg' => 'JPEG Image', 'jpeg' => 'JPEG Image', 'mov' => 'Quicktime File', 'mp3' => 'MP3 File', 'mp4' => 'MPEG 4', 'msg' => 'Email Message', 'pdf' => 'PDF Acrobat File', 'psd' => 'Photoshop File', 'php' => 'PHP File', 'ppt' => 'PowerPoint Presentation', 'txt' => 'Text Document', 'wma' => 'Windows Media Audio', 'xls' => 'Excel File', 'zip' => 'Zip File', 'ttf' => 'True Type Font', 'sql' => 'SQL File', 'rpm' => 'RedHat Package Manager File', 'doc' => 'Word Document', 'png' => 'PNG Image', 'psp' => 'Paint Shop Pro Image', 'obd' => 'Microsoft Binder', 'nrg' => 'Nero Project', 'iso' => 'ISO Image File', 'bmp' => 'Windows Bit Map', 'ini' => 'INI File', 'inf' => 'INF File', 'hlp' => 'Help File', 'reg' => 'Registry File', 'log' => 'Log File', 'chm' => 'Compiled html', 'db' => 'Database' ); $type = isset($filetype[strtolower($ext)]) ? $filetype[$ext] : 'Undefined File Type'; return $type; } // format size function formatSize($size) { $kb = 1024; // Kilobyte $mb = 1024 * $kb; // Megabyte $gb = 1024 * $mb; // Gigabyte $tb = 1024 * $gb; // Terabyte if($size == 0) { return "(empty)"; } if($size < $kb) { return $size." Bytes"; } 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"; } } // get amount of files, dirs, and formatted size function getSize($dir) { global $exceptions, $exceptionClasses, $calcExceptions; $files = 0; $dirs = 0; $memory = 0; $hidden = 0; if ($dir_handle = @opendir($dir)) { while ($file = readdir($dir_handle)) { if($file != "." && $file != "..") { $dir .= "/"; $dir = preg_replace("/\/\//", "/", $dir); // error check: makes sure there are no double slashes if (is_dir($dir.$file)) // add a slash to directories { $dir.$file .= "/"; } if(@is_dir($dir.$file)) { if (!$calcExceptions) // skip if exception { if (in_array($dir, $exceptions) || in_array($file, $exceptions) || in_array($dir.$file, $exceptions)) { continue; } } $sizeBuild = getSize($dir.$file); $files += $sizeBuild[0]; $dirs += $sizeBuild[1]; $memory += $sizeBuild[2]; $dirs++; } else { if (!$calcExceptions) // skip if exception { $fileExt = ereg_replace("^.+\\.([^.]+)$", "\\1", $file); if (in_array($file, $exceptions) || in_array($fileExt, $exceptionClasses) || in_array($dir.$file, $exceptions)) { continue; } } $memory += @filesize($dir.$file); $files++; } } } closedir($dir_handle); } $size[0] = $files; $size[1] = $dirs; $size[2] = $memory; $size[3] = $hidden; return $size; } $root = "./"; // script root directory reference $GET_path = isset($_GET['path']) ? $_GET['path'] : NULL; $path = NULL; $path_dirs = explode('/', './'.$GET_path); // explode folders into array foreach($path_dirs as $dir_list) // create legitimate path (for security) { $path .= (!empty($dir_list) && $dir_list != '.' && $dir_list != '..' ) ? urldecode($dir_list).'/' : ''; } if (!is_dir($path)) // if not a real directory, stop { $path_parent = NULL; $path = NULL; read_directory($root);// recurse files } else { $path_parent = parent_dir($path); // assign parent directory read_directory($path); // recurse files } ?>

/

( folders, files)

  04/18/24, 01:57am
«