001:
002:
003:
004:
005:
006:
007:
008:
009:
010:
011:
012:
013:
014:
015:
016:
017:
018:
019:
020:
021:
022:
023:
024:
025:
026:
027:
028:
029:
030:
031:
032:
033:
034:
035:
036:
037:
038:
039:
040:
041:
042:
043:
044:
045:
046:
047:
048:
049:
050:
051:
052:
053:
054:
055:
056:
057:
058:
059:
060:
061:
062:
063:
064:
065:
066:
067:
068:
069:
070:
071:
072:
073:
074:
075:
076:
077:
078:
079:
080:
081:
082:
083:
084:
085:
086:
087:
088:
089:
090:
091:
092:
093:
094:
095:
096:
097:
098:
099:
100:
101:
102:
103:
104:
105:
106:
107:
108:
109:
110:
111:
112:
113:
114:
115:
116:
117:
118:
119:
120:
121:
122:
123:
124:
125:
126:
|
<?php ini_set('max_execution_time', 900); $Seite = 'TreeSize for PHP-Webspace'; ?> <!doctype html> <html lang="de-DE"> <head> <meta charset="UTF-8"> <meta name="viewport" content="width=device-width, initial-scale=1"> <title><?php echo $Seite; ?></title>
<style type="text/css"> @import url("Ubuntu.css"); html {font-size:100.001%;} body {font-size:80%; background-color:white;} h1 {font-size:130%;} h2 {font-size:110%;} small {font-size:80%;} table {font-size:100%; border-collapse: collapse; margin: 0.5em 0;} td,th {text-align:left; white-space: nowrap; padding: 0 1em; border: 0px solid #ddd;} td.zahl {text-align:right; white-space: nowrap;} a, a:link, a:visited {COLOR: rgb(0,0,138);} a:hover {COLOR: rgb(0,0,238); text-decoration: none;} .silver {color:silver;} .silver a, .silver a:link, .silver a:visited {COLOR: rgb(90,90,138);} .silver a:hover {COLOR: rgb(0,0,238); text-decoration: none;} </style>
</head> <body> <?php if(isset($_GET['directory']) AND $_GET['directory'] > '') {$directory = $_SERVER['DOCUMENT_ROOT'].$_GET['directory'];} else {$directory = $_SERVER['DOCUMENT_ROOT'];} function dirsize($path) { $s = 0; $result[$path] = 0; $handle = @opendir($path); if ($handle) { while (false !== ($file = readdir($handle))) { if ($file != "." && $file != "..") { $name = $path . "/" . $file; if (is_dir($name)) { $ar = dirsize($name); while (list($key, $value) = each ($ar)) {$s++; $result[$key] = $value;} } else {$result[$path] += filesize($name);} } } closedir($handle); } return $result; } $data = dirsize($directory); $data1 = $data;
while (list($key, $value) = each ($data)) { if (!preg_match("'\/'",str_replace($directory.'/','',$key))) { $verzeichnis[str_replace($directory.'/','',$key)] = $value; $dir1 = str_replace($directory.'/','',$key); while (list($key1, $value1) = each ($data1)) { $key2 = str_replace($directory.'/','',$key1); $subdir = preg_split('/\//',$key2); if (preg_match("'\/'",str_replace($directory.'/','',$key1)) AND $dir1 == $subdir[0]) { $verzeichnis[$subdir[0]] += $value1; } } reset($data1); } } @reset($data); @arsort($verzeichnis); @reset($verzeichnis); $handle1 = @opendir($directory); if ($handle1) { while (false !== ($file = readdir($handle1))) { if ($file != "." && $file != "..") { $name = $directory . "/" . $file; if (!is_dir($name)) {$Dateien[$file] = filesize($name);} } } closedir($handle1); } arsort($Dateien); reset($Dateien); ?> <div class="silver"> <h1 id="oben"><?php echo $Seite; ?><small> © <a href="http://rtol.de/tools/treesize/" target="_blank">RTOL.de</a></small></h1> <h2><?php echo str_replace('//','/',$directory); ?></h2> </div> <?php if(isset($_GET['directory'])) { ?> <a href="javascript:history.back()">Zurück</a> <?php } $SumDirs =0; ?> <table> <?php while (list($key, $value) = @each ($verzeichnis)) {$Summe += $value; $SumDirs ++; ?> <tr> <td class="zahl"><?php echo number_format($value, 0, ",", "."); ?></td> <td><a href="<?php echo $_SERVER['PHP_SELF']; ?>?directory=<?php echo $_GET['directory']; ?>/<?php echo str_replace($_SERVER['DOCUMENT_ROOT'].'/','',$key); ?>"> <?php echo str_replace($directory,'',$key); ?></a></td> </tr> <?php } $SumFiles =0; ?> </table> <table> <?php while (list($key, $value) = @each ($Dateien)) {$Summe1 += $value; $SumFiles ++; ?> <tr> <td class="zahl"><?php echo number_format($value, 0, ",", "."); ?></td> <td><?php echo $key; ?></td> <td><?php echo date("d.m.Y", filemtime($directory.'/'.$key)); ?></td> </tr> <?php } ?> </table> <p>Summe <?php echo $SumFiles; ?> Dateien: <?php echo number_format($Summe1 / 1024, 3, ",", "."); ?> kB<br> Summe <?php echo $SumDirs; ?> Ordner: <b><?php echo number_format(($Summe + $Summe1) / 1024 / 1024, 3, ",", "."); ?> MB</b></p> </body> </html>
|