Code: Select all
An error occured while trying to download a file.
If you think that this might be a technical problem send an email to the webmaster.
Code: Select all
An error occured while trying to download a file.
If you think that this might be a technical problem send an email to the webmaster.
Code: Select all
<?php
/*************************************************************************************
Copyright notice
(c) 2002-2003 Oliver Georgi (oliver@phpwcms.de) // All rights reserved.
This script is part of PHPWCMS. The PHPWCMS web content management system is
free software; you can redistribute it and/or modify it under the terms of
the GNU General Public License as published by the Free Software Foundation;
either version 2 of the License, or (at your option) any later version.
The GNU General Public License can be found at http://www.gnu.org/copyleft/gpl.html
A copy is found in the textfile GPL.txt and important notices to the license
from the author is found in LICENSE.txt distributed with these scripts.
This script 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.
This copyright notice MUST APPEAR in all copies of the script!
*************************************************************************************/
require_once ("include/inc_conf/conf.inc.php");
require_once ("include/inc_lib/default.inc.php");
require_once ("include/inc_lib/general.inc.php");
list($size, $fid, $uid) = explode(",", $_GET["id"]);
$size = intval($size);
$fid = intval($fid);
$uid = intval($uid);
if($size && $fid && $uid) {
$err = 0;
$sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND f_trash=0 AND f_public=1 AND ".
"f_id=".$fid." AND f_kid=1 AND f_uid=".$uid." AND f_size='".$size."' LIMIT 1;";
if($result = mysql_query($sql, $db) or die ("error while retrieving file download infos")) {;
if($download = mysql_fetch_array($result)) {
$dl_filename = $download["f_uid"]."_".$download["f_id"];
if(!isEmpty($download["f_ext"])) $dl_filename .= ".".$download["f_ext"];
$dl_path = PHPWCMS_ROOT.$phpwcms["file_path"].$download["f_uid"]."/";
if(file_exists($dl_path.$dl_filename)) { //echo "Datei existiert<br>";
//Send file to user
/* changed: 09-20-2003
if(stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) {$att = "";} else {$att = " attachment;";}
$fp = fopen($dl_path.$dl_filename, "rb");
header("Content-type: ".$download["f_type"]."\n");
header("Content-Disposition: ".$att." filename=".$download["f_name"]."\n");
header("Content-Length: ".$download["f_size"]."\n");
header("Content-Transfer-Encoding: binary\n");
header("Pragma: no-cache\n");
header("Expires: 0\n");
fpassthru($fp);
*/
//Downloads must downloaded to harddisk
//are not opened and showed inside browser
//if possible file format (PDF/JPG...)
$att = (stristr($_SERVER['HTTP_USER_AGENT'],"MSIE")) ? "" : "attachment; ";
header("Content-type: application/force-download");
header("Content-Disposition: ".$att."filename=".$download["f_name"]);
header("Content-Length: " . filesize($dl_path.$dl_filename));
header("Cache-control: private");
header("Pragma: public");
@readfile($dl_path.$dl_filename);
exit;
} else {
$err = 1; //Wenn Datei nicht existiert
}
} else {
$err = 2; //Wenn keine Datei aus Datenbank zurückgegeben wird
}
}
} else {
$err = 3; //Wenn keine korrekte id übergeben wird
}
if($err) {
?><html>
<head>
<title>File Download Error</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link href="include/inc_css/article.css" rel="stylesheet" type="text/css">
</head>
<body bgcolor="#FFFFFF" text="#000000" link="#FF9900" vlink="#FF9900" alink="#FF9900" leftmargin="15" topmargin="15" marginwidth="15" marginheight="15">
<strong>An error (NR:<?php echo $err ?>) occured while trying to download a file.</strong><br>
<img src="img/leer.gif" width="1" height="10"><br>
If you think that this might be a technical problem send an email to the <a href="mailto:<?php echo $phpwcms["admin_email"] ?>"><strong>webmaster</strong></a>.
</body>
</html>
<?php } ?>