Author: null Language: php
Description: No description Timestamp: 2009-10-01 21:46:57 -0400
View raw paste Reply
  1. <?
  2. $url = urlencode(htmlentities($_GET['url'], ENT_NOQUOTES));
  3. if(isset($url)){
  4.         $source = file_get_contents($url);
  5.         $source = htmlspecialchars($source);
  6.         $uhoh[0] = '/<?/';
  7.         $uhoh[1] = '/<%/';
  8.         $uhoh[2] = '/?>/';
  9.         $uhoh[3] = '/%>/';
  10.         $phew[0] = '&lt;?';
  11.         $phew[1] = '&lt;%';
  12.         $phew[2] = '?&gt;';
  13.         $phew[3] = '%&gt;';
  14.         $source = preg_replace($uhoh, $phew, $source);
  15. }
  16. ?>
  17.  
  18. <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
  19. <html>
  20.  
  21. <head>
  22.         <title> <?if(isset($url)){echo 'View page source of '.urldecode($url);}else{echo'View source of remote files';}?></title>
  23. </head>
  24.  
  25. <body>
  26.  
  27. <?php
  28. if(!isset($url)){
  29.         echo '<form action="'.$PHP_SELF.'" method="get">
  30.                         <p>
  31.                         <input type="text" name="url" value="http://yoururlhere/file.htm" />
  32.                         </p>
  33.                   </form>';
  34. }
  35. else{
  36.         echo $source;
  37. }
  38. ?>
  39.  
  40. </body>
  41. </html>
View raw paste Reply