note 38081 deleted from function.show-source by aidan
| From: | aidan@php.net | Date: | Sun, 26 Sep 2004 14:10:48 +0000 |
| Subject: | note 38081 deleted from function.show-source by aidan | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-77394@lists.php.net to get a copy of this message | ||
Note Submitter: Jake
----
I wrote a function for viewing PHP source that only prints the source of files you specify. This
way, if someone requests the source of a file that you didn't register, it will notify the user
and withhold the source =).
function SHOW_SOURCE ()
{
global $_GET;
$FILES = array ("file_1.php", "file_2.php");
$file = $_GET['file'];
if ( ! in_array ($file, $FILES) )
{
echo "<Strong>You Are Not Allowed To View The Source Of The Requested
File!</strong>";
exit;
}
else
{
$the_source = show_source ( $file );
return $the_source;
}
}
?>
I'm sure this could be expanded upon.