Untitled
Posted on October 2, 2009, 1:46 am UTC anonymously (11 months ago)Code (highlighted for PHP)
- <?
- if(isset($url)){
- $source = file_get_contents($url);
- $source = htmlspecialchars($source);
- $uhoh[0] = \'/<?/\';
- $uhoh[1] = \'/<%/\';
- $uhoh[2] = \'/?>/\';
- $uhoh[3] = \'/%>/\';
- $phew[0] = \'<?\';
- $phew[1] = \'<%\';
- $phew[2] = \'?>\';
- $phew[3] = \'%>\';
- $source = preg_replace($uhoh, $phew, $source);
- }
- ?>
- <!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\" \"http://www.w3.org/TR/html4/loose.dtd\">
- <html>
- <head>
- <title> <?if(isset($url)){echo \'View page source of \'.urldecode($url);}else{echo\'View source of remote files\';}?></title>
- </head>
- <body>
- <?php
- echo \'<form action=\"\'.$PHP_SELF.\'\" method=\"get\">
- <p>
- <input type=\"text\" name=\"url\" value=\"http://yoururlhere/file.htm\" />
- </p>
- </form>\';
- }
- else{
- echo $source;
- }
- ?>
- </body>
- </html>