note 28389 added to function.include
| From: | webmaster at rack1 dot php dot net | Date: | Sat, 11 Jan 2003 07:00:12 +0000 |
| Subject: | note 28389 added to function.include | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-41994@lists.php.net to get a copy of this message | ||
I searched for a php file/function which would return an image. Here it is:
<?php
include("D:/pczb.net/functions.php");
if($show) {
$result = mysql_query("SELECT * FROM picoftheweek WHERE id = '$show'");
$row = @mysql_fetch_array($result);
header("Content-Type: ".$row[filetype]);
header("Content-length: ".filesize($row[location]));
if( file_exists($row[location]) ) {
include($row[location]);
}
}
?>
I use this for displaying images that have been placed outside the server document root dir. Users
now cannot view files I don't want them to view (yet).
You can view an example on www.pczb.net/picoftheweek.php
--
http://www.php.net/manual/en/function.include.php
http://master.php.net/manage/user-notes.php?action=edit+28389
http://master.php.net/manage/user-notes.php?action=delete+28389
http://master.php.net/manage/user-notes.php?action=reject+28389