Contents of echo.asp:
<html> <head> <STYLE type="text/css"> body, table {font-family:Comic Sans MS, Times New Roman; font-size:10pt} </STYLE> </HEAD> <body> <center> <Table border="1"> <tr> <td valign='middle' bgcolor='#aaaaaa'> <img src="captsm.gif"> </td> <td valign='middle' bgcolor='#aaaaaa'> <center> <font color="#ffffff"> <font face="Comic Sans MS"> <b>Echo.asp Results <br> Querystring or Form Submissions </td> </tr> </table></center> <% ' ' An inverse to Server.URLEncode ' code by Adam Vandenberg http://flangy.com ' ' http://flangy.com/dev/asp/urldecode.html ' function URLDecode(str) dim re set re = new RegExp str = Replace(str, "+", " ") re.Pattern = "%([0-9a-fA-F]{2})" re.Global = True URLDecode = re.Replace(str, GetRef("URLDecodeHex")) end function ' Replacement function for the above function URLDecodeHex(match, hex_digits, pos, source) URLDecodeHex = chr("&H" & hex_digits) end function ' ' '*************************** TOP OF MAIN ' ' dim objItem dim method_type icf=0 icq=0 For Each objItem in Request.Form icf=icf+1 next For Each objItem in Request.QueryString icq=icq+1 next if icf > 0 then set method_type = Request.Form method_type_out="POST" request_type_out="FORM" else if icq > 0 then set method_type = Request.QueryString method_type_out="GET" request_type_out="QUERYSTRING" end if end if if icf <> 0 or icq <> 0 then %> <p><center> <table border="1" width="90%"> <tr> <td width="15%" align='center' valign='bottom' bgcolor='#aaaaaa'><b>ELEMENT<br>NUMBER</td> <td align='center' valign='bottom' bgcolor='#aaaaaa'><b> NAME </td> <td align='center' valign='bottom' bgcolor='#aaaaaa'><b> VALUE <br>(decoded)</td> <td align='center' valign='bottom' bgcolor='#aaaaaa'><b> VALUE<br>LENGTH<br>(decoded)</td> </tr> <% ic=0 enc=0 vl=0 For Each objItem in method_type if method_type(objItem).Count > 1 then for k=1 to method_type(objItem).Count ic=ic+1 enc=enc+len(objItem) vl=vl+len(method_type(objItem)(k)) response.write "<tr><td align='right'><b>"+cstr(ic)+"</td>" response.write "<td align='center'><b><font color='#0000ff'>"+objItem +"</font> <sup><font color='#ff0000'>duplicate</font></sup></td><td><b><font color='#0000ff'>"+method_type(objItem)(k)+"</font></td><td align='right'><b>" response.write cstr(len(method_type(objItem)(k)))+"</td></tr>" next else ic=ic+1 enc=enc+len(objItem) vl=vl+len(method_type(objItem)) response.write "<tr><td align='right'><b>"+cstr(ic)+"</td>" response.write "<td align='center'><b><font color='#0000ff'>"+objItem +"</font></td><td><b><font color='#0000ff'>"+method_type(objItem)+"</font></td><td align='right'><b>" response.write cstr(len(method_type(objItem)))+"</td></tr>" end if next response.write "<tr><td colspan='3'><b>" if icf > 0 then response.write "METHOD=POST,<br> "+cstr(icf) + " <u>unique</u> FORM items received,<br> "+cstr(ic)+" <u>total</u> FORM items received," if icf=ic then response.write "<br>No Duplicate names." else dif=abs(icf-ic)+1 response.write "<br> "+cstr(dif)+" Duplicate names (see <sup><font color='#ff0000'>duplicate</font></sup> elements above)." end if else response.write "METHOD=GET,<br> "+cstr(icq) +" <u>unique</u> QUERYSTRING items received,<br> "+cstr(ic)+" <u>total</u> QUERYSTRING items received," if icq=ic then response.write "<br>No Duplicate names." else dif=abs(icq-ic)+1 response.write "<br> "+cstr(dif)+" Duplicate names (see <font color='#ff0000'><sup>duplicate</sup></font> elements above)." end if end if llen=50 response.write "</b><p>"+ request_type_out+ " Data Received (URL Encoded -- i.e., as sent by the client, shown "+cstr(llen)+" characters per line):<p><b>" response.write "<font face='monospace'><font color='#0000ff'>" ostr=method_type lostr=len(ostr) lc=int(lostr/llen) for ln=0 to (lc-1) s=mid( ostr, (ln*llen)+1 ,llen) response.write s+"<br>" next s=mid(ostr, (lc*llen)+1, (lostr-(lc*llen)) ) response.write s+"</font></font><br>" lorig=len(method_type) response.write "</b><p>"+Request_type_out+" Data Received (URL Decoded -- i.e., as entered by the user, shown "+cstr(llen)+" characters per line):<p><b>" decoded=URLDecode(method_type) ostr=decoded lostr=len(ostr) lc=int(lostr/llen) response.write "<font face='monospace'><font color='#0000ff'>" for ln=0 to (lc-1) s=mid( ostr, (ln*llen)+1 ,llen) response.write s+"<br>" next s=mid(ostr, (lc*llen)+1, (lostr-(lc*llen)) ) response.write s+"</font></font><br>" response.write "<p>NOTE:</b> <u>URL Encoded</u> means that non-alphabetic characters (i.e., characters that are NOT: 0 thru 9; A through Z; and a through z are converted to an escape sequence -- the % sign followed by the hexadecimal code for the character). Additionally, blank spaces are encoded as a + sign. This is done by the browser before the string is sent to the server. <u>Decoded</u> means that the non-alphabetic characters are converted back to their original single character representation. This decoding process is done on the server. See the original <a href='http://www.ietf.org/rfc/rfc1738.txt'>RFC</a>. See also <A href='ftp://ftp.rfc-editor.org/in-notes/rfc2555.txt'>30 years of RFCs</A> for a historical perspective." response.write "</td><td align='right' valign='top'><b><center>Decoded Lengths:</center><hr>" response.write "<nobr>Total Length of Names = "+cstr(enc)+"</nobr><br>" response.write "<nobr>Total Length of Values = "+cstr(vl)+"</nobr><br>" response.write "<nobr>Number of Equal signs = "+cstr(ic)+"</nobr><br><nobr>" if ic>0 then icm=ic-1 response.write "Number of & signs = "+cstr(icm) else response.write "Number of & signs = 0" end if response.write "</nobr><hr><nobr>Total Bytes Received (decoded) = "+cstr(len(decoded)) response.write "</nobr><br><hr><br><nobr>Total Bytes Received (encoded) = "+cstr(lorig)+"</nobr>" response.write "</td></table></center>" else response.write "<p><b>NO FORM OR QUERYSTRING DATA RECEIVED.</b><p>Check to be sure the HTML objects have <i>name=...</i>" response.write " specified inside the HTML object tag (e.g., <input type='text' name='fred' ... >)<p>" end if response.write "<p><b>Program terminating normally. "+cstr(now) %> </body> </html>
***** end of file *** printed: 208 lines on: 11/23/2009 6:04:58 AM