home *** CD-ROM | disk | FTP | other *** search
/ Netrunner 2004 October / NETRUNNER0410.ISO / regular / ActivePerl-5.8.4.810-MSWin32-x86.msi / _9a740465eef15f0f81f4b79dbb962360 < prev    next >
Text File  |  2004-06-01  |  2KB  |  71 lines

  1. <%@ LANGUAGE = PerlScript%>
  2. <HTML>
  3. <HEAD>
  4. <!-- 
  5.     Copyright (c) 1996, Microsoft Corporation.  All rights reserved.
  6.     Developed by ActiveState Internet Corp., http://www.ActiveState.com
  7. -->
  8. <!-- This PerlScript file enable you to read the source code on your brower directly -->
  9. <TITLE> PerlScript utility to view source code</TITLE>
  10.  
  11. <BODY>
  12. <BODY BGCOLOR=#FFFFFF>
  13. <!-- 
  14.     ActiveState PerlScript sample 
  15.     PerlScript:  The coolest way to program custom web solutions. 
  16. -->
  17.  
  18. <!-- Masthead -->
  19. <TABLE CELLPADDING=3 BORDER=0 CELLSPACING=0>
  20. <TR VALIGN=TOP ><TD WIDTH=400>
  21. <A NAME="TOP"><IMG SRC="PSBWlogo.gif" WIDTH=400 HEIGHT=48 ALT="ActiveState PerlScript" BORDER=0></A><P>
  22. </TD></TR></TABLE>
  23.  
  24. <H2> A PerlScript utility to view Server Side Source</H2>
  25.  
  26. <%
  27.     $filename = $Request->querystring('filename')->item;
  28.     $URL= $Request->querystring('URL')->item;
  29. %>
  30. <hr>
  31. <h3>HTML Source for: <b> <%=$URL%> </b></h3>
  32. <pre>
  33. <%
  34.     # make sure filename does not contain any path info
  35.     $_ = $filename;
  36.     if (/[\/\\]/) {
  37.         %> Error in filename <%= $filename %> <%
  38.     }
  39.     else {
  40.         # get path of this file
  41.         $path = $Request->ServerVariables('PATH_TRANSLATED')->item;
  42.         $path =~ s/[\/\\](\w*\.asp\Z)//m;
  43.         # make path to look at
  44.         $filename = substr $path.'\\'.$filename, 0, 100;
  45.  
  46.         open(SOURCE, $filename);
  47.         while(<SOURCE>) {
  48.             s/</</g;
  49.             s/>/>/g;
  50.             s/<%/<%<b>/g;
  51.             s/%>/<\/b>%>/g;
  52.             $Response->write($_);
  53.         }
  54.         close(SOURCE);
  55.     }    # else valid filename
  56. %>
  57. </pre>
  58.  
  59. <HR><A HREF="index.htm"> Return </A>
  60. <P><P><P>  
  61. <%
  62.     $url = $Request->ServerVariables('PATH_INFO')->item;
  63.     $params = 'filename=showsource.asp&URL='."$url";
  64.     $params =~ s#([^a-zA-Z0-9&_.:%/-\\]{1})#uc '%' . unpack('H2', $1)#eg;
  65. %>
  66. <A HREF="showsource.asp?<%=$params%>">
  67. <h4><i>view showsource.asp itself</i></h4></A>
  68.  
  69. </BODY>
  70. </HTML>
  71.