Well since both pages gave me parse errors I could not check, however I do have code that will allow you to accomplish the task you want.
<?
if(!isset($url))
{
echo "No Page URL specified.";
exit;
}
echo "<h1>Source of: $url</h1>";
$legal_dirs = array("/" => 1);
$dir = dirname($url);
if($dir && $legal_dir)
{
$page_name = $DOCUMENT_ROOT . $url;
}
else
{
$page_name = basename($url);
}
if(file_exists($page_name) && !is_dir($page_name))
{
highlight_file($page_name); // highlight_file can be replaced with show_source as well.
}
else if(is_dir($page_name))
{
echo "<p>No file specified. Can't show source for a directory.</p>\n";
}
?>
an example of how to use this is http://www.yoursite.com/source.php?url=/index.php