<html>
<body bgcolor="#fad888" text="black">
<?
# prevent sourcing of your PHP files
if ( isset($_GET[url]) && !preg_match("@^http://@i", "$_GET[url]", $x) )
{
echo "URL's start with http://";
exit;
}
?>
<form>
<center>
<input type="text" name="url" value="<? echo "$_GET[url]"; ?>">
<input type="submit" value="Show Source Code" />
<br />
<textarea cols="50" rows="10" growable>
<?
if ( isset($_GET[url]) )
{
/*
read surce code into a string
suppress PHP error messages
die if can't read file
*/
@$string = file_get_contents($_GET[url]) or die("Cannot read $_GET[url]");
# make line breaks in source code for readability
$string = str_replace("><", ">\n<", $string);
# escape angle brackets for textarea
$string = htmlspecialchars($string);
echo "$string";
}
?>
</textarea>
</center>
</form>
</body>
</html>