Hab ein Prob.
wenn ich dann auf ordner gehe, und ein file runterladen möchte, zeigt er mir an :
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 78
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 79
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 80
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 81
oder bei nem anderen file :
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 144
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 145
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 146
Warning: Cannot modify header information - headers already sent by (output started at /var/www/e8w45w75c4/dir.php:27) in /var/www/e8w45w75c4/dir.php on line 147
und irgendwelche zeichen (siehe bild)
hier die dir.php :
Zeile 77 - 82
PHP-Code:
$arTemp = explode("/", $down);
if (count($arTemp) > 1) {
array_pop($arTemp);
$current = implode("/", $arTemp);
}
if (file_exists($path)) {
header("Content-type: application/octet-stream\n");
header("Content-disposition: attachment; filename=\"".$file."\"\n");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . file_size($path) . "\n");
// write the session to close so you can continue to browse on the site.
This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License (GPL)
as published by the Free Software Foundation; either version 2
of the License, or (at your option) any later version.
This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.
To read the license please visit http://www.gnu.org/copyleft/gpl.html
// Are we to delete something?
if ($del != "") {
$current = delDirEntry($del);
header("Location: dir.php?dir=".urlencode($current));
}
// Are we to download something?
if ($down != "") {
// is enabled ?
if ($cfg["enable_file_download"] != 1) {
AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: ".$cfg["user"]." tried to use download (".$down.")");
showErrorPage("download is disabled.");
}
$current = "";
// Yes, then download it
// we need to strip slashes twice in some circumstances
// Ex. If we are trying to download test/tester's file/test.txt
// $down will be "test/tester\\\'s file/test.txt"
// one strip will give us "test/tester\'s file/test.txt
// the second strip will give us the correct
// "test/tester's file/test.txt"
$down = stripslashes(stripslashes($down));
if (isValidPath($down)) {
$path = $cfg["path"].$down;
$p = explode(".", $path);
$pc = count($p);
$f = explode("/", $path);
$file = array_pop($f);
$arTemp = explode("/", $down);
if (count($arTemp) > 1) {
array_pop($arTemp);
$current = implode("/", $arTemp);
}
if (file_exists($path)) {
header("Content-type: application/octet-stream\n");
header("Content-disposition: attachment; filename=\"".$file."\"\n");
header("Content-transfer-encoding: binary\n");
header("Content-length: " . file_size($path) . "\n");
// write the session to close so you can continue to browse on the site.
@session_write_close();
//$fp = fopen($path, "r");
$fp = popen("cat ".escapeshellarg($path), "r");
fpassthru($fp);
pclose($fp);
// log
AuditAction($cfg["constants"]["fm_download"], $down);
exit();
} else {
AuditAction($cfg["constants"]["error"], "File Not found for download: ".$cfg['user']." tried to download ".$down);
}
} else {
AuditAction($cfg["constants"]["error"], "ILLEGAL DOWNLOAD: ".$cfg['user']." tried to download ".$down);
}
header("Location: dir.php?dir=".urlencode($current));
}
// Are we to download something?
if ($tar != "") {
// is enabled ?
if ($cfg["enable_file_download"] != 1) {
AuditAction($cfg["constants"]["error"], "ILLEGAL ACCESS: ".$cfg["user"]." tried to use download (".$tar.")");
showErrorPage("download is disabled.");
}
$current = "";
// Yes, then tar and download it
// we need to strip slashes twice in some circumstances
// Ex. If we are trying to download test/tester's file/test.txt
// $down will be "test/tester\\\'s file/test.txt"
// one strip will give us "test/tester\'s file/test.txt
// the second strip will give us the correct
// "test/tester's file/test.txt"
$tar = stripslashes(stripslashes($tar));
if (isValidPath($tar)) {
// This prevents the script from getting killed off when running lengthy tar jobs.
ini_set("max_execution_time", 3600);
$tar = $cfg["path"].$tar;
$arTemp = explode("/", $tar);
if (count($arTemp) > 1) {
array_pop($arTemp);
$current = implode("/", $arTemp);
}
// Find out if we're really trying to access a file within the
// proper directory structure. Sadly, this way requires that $cfg["path"]
// is a REAL path, not a symlinked one. Also check if $cfg["path"] is part
// of the REAL path.
if (is_dir($tar)) {
$sendname = basename($tar);
switch ($cfg["package_type"]) {
Case "tar":
$command = "tar cf - \"".addslashes($sendname)."\"";
break;
Case "zip":
$command = "zip -0r - \"".addslashes($sendname)."\"";
break;
default:
$cfg["package_type"] = "tar";
$command = "tar cf - \"".addslashes($sendname)."\"";
break;
}
// HTTP/1.0
header("Pragma: no-cache");
header("Content-Description: File Transfer");
header("Content-Type: application/force-download");
header('Content-Disposition: attachment; filename="'.$sendname.'.'.$cfg["package_type"].'"');
// write the session to close so you can continue to browse on the site.
@session_write_close();
// Make it a bit easier for tar/zip.
chdir(dirname($tar));
passthru($command);
AuditAction($cfg["constants"]["fm_download"], $sendname.".".$cfg["package_type"]);
exit();
} else {
AuditAction($cfg["constants"]["error"], "Illegal download: ".$cfg['user']." tried to download ".$tar);
}
} else {
AuditAction($cfg["constants"]["error"], "ILLEGAL TAR DOWNLOAD: ".$cfg['user']." tried to download ".$tar);
}
header("Location: dir.php?dir=".urlencode($current));
}
// download
if ($cfg["enable_file_download"]) {
// Show the download button
echo "<a href=\"dir.php?down=".urlencode($dir.$entry)."\" >";
echo "<img src=\"images/download_owner.gif\" width=16 height=16 title=\"Download\" border=0>";
echo "</a>";
}
// The following lines of code were suggested by Jody Steele jmlsteele@stfu.ca
// this is so only the owner of the file(s) or admin can delete
// only give admins and users who "own" this directory
// the ability to delete files
if(IsAdmin($cfg["user"]) || preg_match("/^" . $cfg["user"] . "/",$dir)) {
//echo "<a href=\"dir.php?del=".urlencode($dir.$entry)."\" onclick=\"return ConfirmDelete('".addslashes($entry)."')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\""._DELETE."\" border=0></a>";
/* --- Multi Delete Hack --- */
/* checkbox appended to line */
echo "<a href=\"dir.php?del=".urlencode($dir.$entry)."\" onclick=\"return ConfirmDelete('".addslashes($entry)."')\"><img src=\"images/delete_on.gif\" width=16 height=16 title=\""._DELETE."\" border=0></a><input type=\"checkbox\" name=\"file[]\" value=\"".urlencode($dir.$entry)."\">";
/* --- Multi Delete Hack --- */
} else {
echo " ";
}
echo "</td></tr>\n";
if ($bg == $bgLight)
$bg = $bgDark;
else
$bg = $bgLight;
}
}
}
// Some Stats dir hack
closedir($handle);
// ***************************************************************************
// ***************************************************************************
// Checks for the location of the users directory
// If it does not exist, then it creates it.
function checkUserPath() {
global $cfg;
// is there a user dir?
if (!is_dir($cfg["path"].$cfg["user"])) {
//Then create it
mkdir($cfg["path"].$cfg["user"], 0777);
}
}
// This function returns the extension of a given file.
// Where the extension is the part after the last dot.
// When no dot is found the noExtensionFile string is
// returned. This should point to a 'unknown-type' image
// time by default. This string is also returned when the
// file starts with an dot.
function getExtension($fileName) {
$noExtensionFile="unknown"; // The return when no extension is found
//Prepare the loop to find an extension
$length = -1*(strlen($fileName)); // The maximum negative value for $i
$i=-1; //The counter which counts back to $length
//Find the last dot in an String while (substr($fileName,$i,1) != "." && $i > $length) {$i -= 1; }
//Get the extension (with dot)
$ext = substr($fileName,$i);
//Decide what to return.
if (substr($ext,0,1)==".") {$ext = substr($ext,((-1 * strlen($ext))+1)); } else {$ext = $noExtensionFile;}
//Return the extension
return strtolower($ext);
}