show php source
this script gives you an easy way to allow visitors to view your php source code. it uses php’s highlighting functions to color the php code for easier reading, and limits visitors to viewing source of files with the php extension inside the document root (usually public_html). note that if you have sensitive information such as sql passwords in a php file you should be sure that it is outside document root, or modify the show source script to explicitly exclude that file.
the zip file contains 3 files: a php script, a css file, and an .htaccess file. the .htaccess file is not required, but can be added to your .htaccess file so that /source/index.php will show the source of index.php. if this is done, you can use the following php code to make a link to the source of the current page:
<a href="/source<?php echo $_SERVER['PHP_SELF']; ?>">view php source</a>
if the .htaccess file is not used, change
/showsource.php?file= for the same result. the php file references the css file. all files are expected to be in the document root (i.e. http://www.example.org/showsource.css) and use the filenames they have in the zip file. if you move or rename the files, you will have to update the other files so they know where to find each other.