Location: PHPKode > projects > CMSmelborp > CMSmelborp/showfile.php
<?php
/*******************************************************************************
License:
	Copyright 2005 Ryan Morehart
	Licensed under the Apache License, Version 2.0 (the "License");
	you may not use this file except in compliance with the License.
	You may obtain a copy of the License at
	
	http://www.apache.org/licenses/LICENSE-2.0
	
	Unless required by applicable law or agreed to in writing, software
	distributed under the License is distributed on an "AS IS" BASIS,
	WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
	See the License for the specific language governing permissions and
	limitations under the License.
	
Filename: /showfile.php

Purpose: Returns "external" files 

Processed parameters: (TYPE - NAME - DESCRIPTION - DEFAULT)
	GET - name - name of file to return
*******************************************************************************/

require_once 'includes/user_standard.php';

// Ensure a file was specified
if(!isset($_GET['name']))
{
	?>
	<html>
	<head>
		<title>File not specfied</title>
	</head>
	<body>
		<h1>File not specified</h1>
		<p>No file was specified for retrieval.</p>
	</body>
	</html>
	<?php
	die();
}

// Get file
$file = getFile($connection, $_GET['name']);
if($file === false)
{
	?>
	<html>
	<head>
		<title>File not found</title>
	</head>
	<body>
		<h1>File not found</h1>
		<p>The file you requested could not be found.</p>
	</body>
	</html>
	<?php
	die();
}

// Output
if(!empty($file['file_type']))
{
	header('Content-type: ' . $file['file_type']);
}
else
{
	header('Content-type: text/plain');
}
echo $file['data'];
?>
Return current item: CMSmelborp