Create a script to which you can pass a file namem and calls show_source()
on the file name.

Be very careful to check the input, such that the file name parameter
which eventually gets passed to show_source() cannot be one which you do
not want to be displayed to everyone in the world.

When using the function to show off living code, I make sure the only
files that can be viewed are files in specific directories.  I also make
sure the file exists in the file system ... displaying an appropriate
messages when the file will not be diplayed.

        ~Chris                           /"\
                                         \ /     September 11, 2001
                                          X      We Are All New Yorkers
                                         / \     rm -rf /bin/laden

On Thu, 14 Feb 2002, Kevin Stone wrote:

> How can I open a local PHP script and view its code to the browser?  The
> Readfile() method appears to parse and execute the code.  The Fopen()
> method appears to parse and then not execute the code, leaving a blank
> screen, or at the very least displaying any non-PHP text existing in the
> script.  This is obviously rare question because I can't find any
> references on this list or on Usenet.  Is there a trick to this?  Or is
> it simply not possible.
> Much Thanks,
> Kevin Stone <[EMAIL PROTECTED]>

PHP General Mailing List (
To unsubscribe, visit:

Reply via email to