\n"; echo "\n"; echo "\n"; echo "Dateiaustausch\n"; echo "\n"; echo "\n"; include '../data/nav.html'; echo "

WEBSEITE VON MICHAEL PUFf

\n"; echo "

INDEX OF /Austausch/

\n"; echo "
\n"; echo "

Datei auswählen

\n"; echo "
\n"; echo "\n"; echo "Datei:

\n"; echo "\n"; echo "
\n"; echo "

Dateien

\n"; echo "
\n"; echo "\n"; echo "\n"; $count = 0; $totalSize = 0; foreach ($files as $file) { if ($file != "index.php") { $count++; $fSize = filesize($file); $totalSize += $fSize; $fDate = date("Y-m-j H:i:s", filemtime($file)); $s = ""; echo $s; } } echo "
NameGrößeZuletzt geändertAktionen
".$file." ".$fSize." Byte ".$fDate."
\n"; echo "
\n"; echo "

Anzahl Dateien: ".$count." Größe: ".$totalSize." Bytes

\n"; echo "

Skriptversion: ".date("Y-m-j H:i:s", filemtime("index.php"))."

\n"; echo "\n"; echo "\n"; } function htmlOutput($h2, $text) { echo "\n"; echo "\n"; echo "\n"; echo "Datei hochladen\n"; echo "\n"; echo "\n"; echo "

Datei hochladen

\n"; echo "
\n"; echo "

".$h2."

\n"; echo "

".$text."

\n"; echo "\n"; echo "\n"; } function listFiles($dir) { $files = Array(); $handle = opendir($dir); $count = 0; while(false !== ($file = readdir($handle))) { if (is_file($dir.$file) && ($file[0] != '.')) { $files[$count] = $file; $count++; } } closedir($handle); $files_lowercase = array_map('strtolower', $files); array_multisort($files_lowercase, SORT_ASC, $files); return $files; } function modifyIfIsIndexFile($filename) { $filenameParts = explode(".", $filename); if ($filenameParts[0] == "index") { return $file['name'] = "_".$filename; } else return $filename; } function modifyIfFileStartsWithDot($filename) { if ($filename[0] == ".") { Return substr_replace($filename, "_", 0, 1); } else Return $filename; } function upload($dir, $file) { global $errorMsg; $file['name'] = modifyIfIsIndexFile($file['name']); $file['name'] = modifyIfFileStartsWithDot($file['name']); $ret = move_uploaded_file($file['tmp_name'], $file['name']); $errorMsg = $php_errormsg; return $ret; } function deleteFile($file) { global $errorMsg; $ret = @unlink($file); $errorMsg = $php_errormsg; return $ret; } function makeDownload($file, $dir, $type) { global $errorMsg; header("Content-Type: $type"); header("Content-Disposition: attachment; filename=\"$file\""); $ret = readfile($dir.$file); $errorMsg = $php_errormsg; return $ret; } if (empty($action)) { showFormAndFiles(listFiles("./")); } elseif ($action == "upload") { if (upload("/Austausch", $filename)) { showFormAndFiles(listFiles("./")); } else { htmlOutput("Fehler", $errorMsg); } } elseif ($action == "delete") { if (deleteFile($fileToDelete)) { showFormAndFiles(listFiles("./")); } else { htmlOutput("Fehler", $errorMsg); } } elseif ($action == "download") { if (!makeDownLoad($fileToDownload, "./", "multipart")) { htmlOutput("Fehler", $errorMsg); } } ?>