| 1 | <p> |
| 2 | <!-- '************************************** ' Name: View Script ' |
| 3 | Description:This script will display the source of an ASP script without |
| 4 | havin to create a separate text or html file |
| 5 | Colors are kinda funky, but can easily be changed to fit your own needs. |
| 6 | Code includes the html too. |
| 7 | Works great for ASP source sites and/or tutorials! |
| 8 | |
| 9 | By: Kathi O'Shea ' ' ' |
| 10 | Inputs:None |
| 11 | Returns:None |
| 12 | Assumes:To retain indented formatting when script is displayed. |
| 13 | Do not use tabs in your scripts - using spaces instead will keep your formatting |
| 14 | in the display. |
| 15 | Code is commented for your pleasure |
| 16 | Side Effects:None |
| 17 | This code is copyrighted and has limite ' d warranties. Please see |
| 18 | http://www.Planet-Source-Code.com/xq/ASP/txtCodeId.1349/lngWId.4/qx/vb/scripts/ShowCode.htm |
| 19 | for details. |
| 20 | Script by Kathi O'Shea, k.oshea@usa.net, 1/22/99. |
| 21 | A link to my ASP site at http://www.attitude.com/users/kathi |
| 22 | is always appreciated! |
| 23 | '************************************** |
| 24 | --> |
| 25 | <html> |
| 26 | |
| 27 | <head> |
| 28 | <title>Ver código fuente 2 - Códigos asp, programacion asp, descargas asp, rutinas asp</title> |
| 29 | </head> |
| 30 | |
| 31 | |
| 32 | <body> |
| 33 | |
| 34 | </p> |
| 35 | <table width="600" border="0"> |
| 36 | <tr> |
| 37 | <td colspan="2" align="center"><font face="Arial"> |
| 38 | <h2><font size="3">Código fuente de: <%= request("URL") %></font></h2> |
| 39 | </font></td> |
| 40 | </tr> |
| 41 | <tr> |
| 42 | <td width="440"> |
| 43 | <% |
| 44 | ' *** If you change the colors, be sure to change the * |
| 45 | ' *** color code box to match your colors |
| 46 | ' *** That's it... just one last note: on your scripts, |
| 47 | ' *** if you want them to retain their formatting, make |
| 48 | ' *** sure to indent with SPACES and not tabs or it will |
| 49 | ' *** not display correctly. |
| 50 | %> |
| 51 | |
| 52 | <% |
| 53 | Filedir=Server.MapPath("/") |
| 54 | ' URL = request("URL") |
| 55 | URL = request("Vsource") |
| 56 | ' FileSpec=Filedir & "\" & URL & ".asp" |
| 57 | FileSpec=server.mappath("Ver código fuente2.asp") |
| 58 | Set fs = CreateObject("Scripting.FileSystemObject") |
| 59 | Set WorkFile = fs.OpenTextFile(Filespec,1,False) |
| 60 | response.write "<table border=0 cellspacing=0 cellpadding=0>" |
| 61 | counter=0 |
| 62 | do until Workfile.AtEndofStream |
| 63 | counter=counter+1 |
| 64 | Line=WorkFile.readline |
| 65 | Line=Replace(Line,">",">") |
| 66 | Line=Replace(Line,"<","<") |
| 67 | Line=Replace(Line," "," ") |
| 68 | If Line="" then |
| 69 | ' this colors any blank lines as straight html code |
| 70 | response.write "<tr bgcolor='cornsilk'>" |
| 71 | ElseIf instr(Line,"response")>=1 then |
| 72 | ' this colors any lines that returns htm |
| 73 | ' l to the browser |
| 74 | response.write "<tr bgcolor='bisque'>" |
| 75 | ElseIf instr(Line,"<")>=1 and instr(Line,"%")>=2 or (instr(Line,"%")>=1 and instr(Line,">")>=2) then |
| 76 | ' this colors any lines with vbscript op |
| 77 | ' ening and closing tags |
| 78 | If instr(Line,"=")=0 then |
| 79 | ' this is for lines in html blocks with |
| 80 | ' vbscript variables |
| 81 | ' dropped into the html |
| 82 | response.write "<tr bgcolor='tan'>" |
| 83 | Else |
| 84 | ' this is for just the opening and closi |
| 85 | ' ng tags for vbscript blocks |
| 86 | response.write "<tr bgcolor='ffcc66'>" |
| 87 | End If |
| 88 | ElseIf instr(Line,"<")=0 and instr(Line,">")=0 or instr(Line,"response")>=1 and Line<>"" then |
| 89 | ' this is for any vbscript within a scri |
| 90 | ' pt block that doesn't return html |
| 91 | response.write "<tr bgcolor='wheat'>" |
| 92 | Else |
| 93 | ' this is for lines of html that have no |
| 94 | ' variables dropped in |
| 95 | response.write "<tr bgcolor='cornsilk'>" |
| 96 | End If |
| 97 | ' the following line was dropped in so I |
| 98 | ' could use it for files I already |
| 99 | ' had done. It won't hurt anything leavi |
| 100 | ' ng it in, but if you would like to |
| 101 | ' take it out, just take out lines 71-75 |
| 102 | ' and line 78 |
| 103 | If Line="</xmp>" then |
| 104 | Do while not WorkFile.AtEndofStream |
| 105 | WorkFile.skipline |
| 106 | loop |
| 107 | Else |
| 108 | response.write "<td valign='top' align='right'>" & Counter & "</td>" |
| 109 | response.write "<td>" & Line & "</td></tr>" |
| 110 | End If |
| 111 | loop |
| 112 | response.write "</table>" |
| 113 | WorkFile.Close |
| 114 | set WorkFile=nothing |
| 115 | set fs=nothing |
| 116 | %> </td> |
| 117 | <td valign="top"><font color="#C5BE60"><b>Códigos de color</b></font><table width="200" border="1"> |
| 118 | <tr bgcolor="cornsilk"> |
| 119 | <td><font size="2">Código HTML</font></td> |
| 120 | </tr> |
| 121 | <tr bgcolor="bisque"> |
| 122 | <td><font size="2">VBScript devolviendo html al navegador</font></td> |
| 123 | </tr> |
| 124 | <tr bgcolor="wheat"> |
| 125 | <td><font size="2">Script del lado del servidor y respuestas enviadas al cliente</font></td> |
| 126 | </tr> |
| 127 | <tr bgcolor="ffcc66"> |
| 128 | <td><font size="2">HTML con variables vbscript</font></td> |
| 129 | </tr> |
| 130 | <tr bgcolor="tan"> |
| 131 | <td><font size="2">Apertura y cierra de delimitadores de vbscript</font></td> |
| 132 | </tr> |
| 133 | </table> |
| 134 | </td> |
| 135 | </tr> |
| 136 | </table> |
| 137 | |
| 138 | </body> |
| 139 | |
| 140 | </html> |