Demo for showsource()
A demo of the output of showsource()
<?php
/*
A show source script written in PHP.
Script obtained from http://ekstreme.com . See the website for a full
discussion and to get the latest version.
Written by Pierre Far, July 2001
You are free to use and distribute this script without fee. This script
is provided 'AS IS' without any warranty. Use at your own risk.
Place the following code inside a webpage:
<?php
echo "<p><a href=\"showsource.php?filename=". $_SERVER['SCRIPT_NAME']. "\">Show Source</a></p>";
?>
Where showsource.php is this script.
Notice that this code is not secure as it stands. Wrap it around with
security checks.
*/
//end error-trapping section
if(strlen($filename)>0){
$filename = $DOCUMENT_ROOT . $filename;
if (ereg("(\.php)$",$filename) && !ereg("\/\.\.", $filename)){
show_source("$filename");
}
else{
echo "\nOoops - error somewhere!";
}
exit;
}
else{
echo "Please specify a file!";
exit;
}
?>
