// 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! *************************************************************************************/ session_start(); $phpwcms = array(); require_once ('../../config/phpwcms/conf.inc.php'); require_once ('../inc_lib/default.inc.php'); require_once (PHPWCMS_ROOT.'/include/inc_lib/dbcon.inc.php'); require_once (PHPWCMS_ROOT.'/include/inc_lib/general.inc.php'); checkLogin(); require_once (PHPWCMS_ROOT.'/include/inc_lib/backend.functions.inc.php'); $dl = isset($_GET["dl"]) ? intval($_GET["dl"]) : 0; $pl = isset($_GET["pl"]) ? intval($_GET["pl"]) : 0; if($dl) { $err = 0; if(!$pl) { $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_trash=0 AND ". "f_id=".$dl." AND f_kid=1 AND f_uid=".intval($_SESSION["wcs_user_id"])." LIMIT 1"; //09-20-2003: WHERE f_aktiv=1 AND... not neccessary } else { $sql = "SELECT * FROM ".DB_PREPEND."phpwcms_file WHERE f_aktiv=1 AND f_trash=0 AND ". "f_id=".$dl." AND f_kid=1 AND (f_public=1 OR f_uid=".intval($_SESSION["wcs_user_id"]).") 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_hash"]; if($download["f_ext"]) { $dl_filename .= '.'.$download["f_ext"]; } $dl_path = PHPWCMS_ROOT.$phpwcms["file_path"]; if(file_exists($dl_path.$dl_filename)) { //Send file to user //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; "; if(!is_mimetype_format($download["f_type"])) { $download["f_type"] = get_mimetype_by_extension($download["f_ext"]); } header("Content-type: ".$download["f_type"]); header('Content-Disposition: attachment; filename="'.$download["f_name"].'"'); header("Content-Length: " . filesize($dl_path.$dl_filename)); if(readfile($dl_path.$dl_filename)) { exit(); } else { $err = 4; // Error reading file } } else { $err = 1; // File does not exist } } else { $err = 2; // File not found in database } } } else { $err = 3; // False ID given } if($err) { session_destroy(); ?> phpwcms File Error

An error (ID:) occured while trying to download a file of your directory.

Please login again
and try another file.

If you think that this might be a technical problem send an email to the webmaster.