SitePoint Sponsor

User Tag List

Page 6 of 6 FirstFirst ... 23456
Results 126 to 127 of 127
  1. #126
    SitePoint Wizard siteguru's Avatar
    Join Date
    Oct 2002
    Location
    Scotland
    Posts
    3,609
    Mentioned
    2 Post(s)
    Tagged
    0 Thread(s)
    Here's an ASP page that will give you details of the ASP server variables, cookies etc. on your server. Live example can be found here.
    Code ASP:
    <%
    Sub aspinfo()
    Dim strVariable, strASPVersion
    Dim strCookie, strKey, strSession
     
    'Retrieve the version of ASP
    strASPVersion = ScriptEngine & " Version " & _
    ScriptEngineMajorVersion & "." & _
    ScriptEngineMinorVersion
    %>
    <!DOCTYPE HTML Public "-//W3C//DTD HTML 4.01 Transitional//EN">
    <html>
    <head>
    <style type="text/css"><!--
    a { text-decoration: none; }
    a:hover { text-decoration: underline; }
    h1 { font-family: arial, helvetica, sans-serif; font-size: 18pt; font-weight: bold;}
    h2 { font-family: arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}
    body, td { font-family: arial, helvetica, sans-serif; font-size: 10pt; }
    th { font-family: arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }
    //--></style>
    <title>aspinfo()</title></head>
     
    <body>
    <div align="center">
    <table width="80%" border="0" bgcolor="#000000" cellspacing="1" cellpadding="3">
    <tr>
    <td align="center" valign="top" bgcolor="#FFFFAE" align="left" colspan="2">
    <h3>ASP (<%= strASPVersion %> )</h3>
    </td>
    </tr>
    </table>
     
    <br>
    <hr>
    <br>
     
    <h3>Server Variables</h3>
    <table width="80%" border="0" bgcolor="#000000" cellspacing="1" cellpadding="3">
    <%
    For Each strVariable In Request.ServerVariables
    Response.write("<tr>")
    Response.write("<th width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strVariable & "</th>")
    Response.write("<td bgcolor=""#FFFFD9"" align=""left"">" & Request.ServerVariables(strVariable) & " </td>")
    Response.write("</tr>")
    Next 'strVariable
    %>
    </table>
     
    <br>
    <hr>
    <br>
     
    <h3>Cookies</h3>
    <table width="80%" border="0" bgcolor="#000000" cellspacing="1" cellpadding="3">
    <%
    For Each strCookie In Request.Cookies
    If Not Request.Cookies(strCookie).HasKeys Then
    Response.write("<tr>")
    Response.write("<th width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strCookie & "</th>")
    Response.write("<td bgcolor=""#FFFFD9"" align=""left"">" & Request.Cookies(strCookie) & " </td>")
    Response.write("</tr>")
    Else
    For Each strKey In Request.Cookies(strCookie)
    Response.write("<tr>")
    Response.write("<th width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strCookie & "(" & strKey & ")</th>")
    Response.write("<td bgcolor=""#FFFFD9"" align=""left"">" & Request.Cookies(strCookie)(strKey) & " </td>")
    Response.write("</tr>")
    Next
    End If
    Next
    %>
    </table>
     
    <br>
    <hr>
    <br>
     
    <h3>Session Cookies</h3>
    <table width="80%" border="0" bgcolor="#000000" cellspacing="1" cellpadding="3">
    <%
    For Each strSession In Session.Contents
    Response.write("<tr>")
    Response.write("<th width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strSession & "</th>")
    Response.write("<td bgcolor=""#FFFFD9"" align=""left"">" & Session(strSession) & " </td>")
    Response.write("</tr>")
    Next
    %>
    </table>
     
    <br>
    <hr>
    <br>
     
    <h3>Other variables</h3>
    <table width="80%" border="0" bgcolor="#000000" cellspacing="1" cellpadding="3">
    <tr><th width="30%" bgcolor="#FFFFAE" align="left">Session.sessionid</th><td bgcolor="#FFFFD9"><%= Session.sessionid %></td></tr>
    <tr><th width="30%" bgcolor="#FFFFAE" align="left">Server.MapPath</th><td bgcolor="#FFFFD9"><%= Server.MapPath ("/") %></td></tr>
    </table>
    </div>
     
    </body>
    </html>
    <%
    End Sub
    aspinfo()
    %>
    Ian Anderson
    www.siteguru.co.uk

  2. #127
    SitePoint Member
    Join Date
    Jul 2011
    Posts
    2
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    This routine converts a string of text to a string of unicode characters. So the string:
    "look@me.com"
    Becomes:
    UTF-8
    "& #108;& #111;& #111;& #107;& #64;& #109;& #101;& #46;& #99;& #111;& #109;"
    Long UTF-8
    "look@me.com"
    UTF-8 Hex
    "&#x6C;&#x6F;&#x6F;&#x6B;&#x40;&#x6D;&#x65;&#x2E;&#x63;&#x6F;&#x6D;"
    This effectively masks the address so that it is very difficult to be scanned and it is still effective.
    Code:
    <%@ Language=VBScript %>
    <%
    Function CloakIt(ByVal inTxt, ByVal iType)
    ' Convert An Input String To Unicode Character Codes
    Dim iInd
    Dim sOut
        If Len(inTxt) = 0 Then
            CloakIt = ""
            Exit Function
        End If
        For iInd = 1 To Len(inTxt)
            Select Case iType
            Case 2
                ' Long UTF-8 encoding without semicolons
                sOut = sOut & "&#" & Right("0000000" & CStr(Asc(Mid(inTxt, iInd, 1))), 7)
            Case 3
                ' Hex encoding without semicolons
                sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1)))
            Case 4
                ' Hex encoding with semicolons
                sOut = sOut & "&#x" & Hex(Asc(Mid(inTxt, iInd, 1))) & ";"
            Case Else
                ' UTF-8 Unicode Encoding
                sOut = sOut & "&#" & CStr(Asc(Mid(inTxt, iInd, 1))) & ";"
            End Select
        Next
        CloakIt = sOut
    End Function
    %>
    
    <html><head><title> Cloak-It
    </title>
    </head>
    <body link=#000080 text=#000000 vLink=#008080 bgColor=#ffffff><font face="Tahoma,Arial,Helvetica,Verdana">
    <h3 align=center>Cloak It - Email Address Cloaker</h3>
    <FORM action="CloakIt.asp?entered=true" method=POST id=form1 name=form1>
    <TABLE BORDER=0 CELLSPACING=1 CELLPADDING=1>
        <TR>
            <TD ALIGN=RIGHT WIDTH=25%>Plain String:</TD>
            <TD><INPUT type="text" SIZE=100 id=plain name=plain VALUE="<%= Request.Form("plain") %>"></TD>
        </TR>
        <TR>
            <TD ALIGN=RIGHT><%
            Select Case Request.Form("CloakType")
            Case "2"
                Response.Write "Long UTF-8 encoding:"
            Case "3"
                Response.Write "Hex encoding No "";"":"
            Case "4"
                Response.Write "Hex encoding With "";"":"
            Case Else
                Response.Write "UTF-8 Unicode Encoding:"
            End Select
            %></TD>
            <TD><INPUT type="text" id=Cloaked name=Cloaked SIZE=100 VALUE="<%= Replace(CloakIt(Request.Form("plain"), Request.Form("CloakType")),"&", "&amp;") %>"></TD>
        </TR>
        <TR>
            <TD ALIGN=RIGHT>Displayed Encoded String 1:</TD>
            <TD><%= CloakIt(Request.Form("plain"), Request.Form("CloakType")) %></TD>
        </TR>
        <TR>
            <TD ALIGN=RIGHT>Displayed Encoded String 2:</TD>
            <TD><INPUT type="text" id=show name=show SIZE=100 VALUE="<%= CloakIt(Request.Form("plain"), Request.Form("CloakType")) %>"></TD>
        </TR>
        <TR>
            <TD ALIGN=RIGHT VALIGN=TOP>Cloaking Type:</TD>
            <TD><INPUT TYPE=radio NAME="CloakType" VALUE="1" <%If Request.Form("CloakType")="1" Then Response.Write " CHECKED"%>> UTF-8 Unicode Encoding<br>
                <INPUT TYPE=radio NAME="CloakType" VALUE="2" <%If Request.Form("CloakType")="2" Then Response.Write " CHECKED"%>> Long UTF-8 encoding without semicolons<br>
                <INPUT TYPE=radio NAME="CloakType" VALUE="3" <%If Request.Form("CloakType")="3" Then Response.Write " CHECKED"%>> Hex encoding without semicolons<br>
                <INPUT TYPE=radio NAME="CloakType" VALUE="4" <%If Request.Form("CloakType")="4" Then Response.Write " CHECKED"%>> Hex encoding with semicolons
            </TD>
        </TR>
    </TABLE>
    <INPUT type="submit" value="Submit" name=Submit> <INPUT type="reset" value="Reset" id=reset1 name=reset1>
    </FORM>
    </font></body></html>


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •