메뉴 건너뛰기

Dev tips

ASP ASP에서 phpinfo()처럼 ... ASPINFO()

taknim 2005.01.25 20:30 조회 수 : 9830 추천:2114

php에서 phpinfo 효과를 보여주는 함수

<%
'--------------------------------------------------------------------------------------------
' ASP 전체 정보 가져오는 Sub
'--------------------------------------------------------------------------------------------
Sub ASPInfo()
        Dim strVariable, strASPVersion
        Dim strCookie, strKey, strSession

        'ASP 버전 정보
        strASPVersion =        ScriptEngine & " Version " & _
                                        ScriptEngineMajorVersion & "." & _
                                        ScriptEngineMinorVersion

        Response.Write("<HTML>" & VbCrLf)
        Response.Write("<HEAD>" & VbCrLf)
        Response.Write("<style type=""text/css"">" & VbCrLf)
        Response.Write("<!--" & VbCrLf)
        Response.Write("        a { text-decoration: none; }" & VbCrLf)
        Response.Write("        a:hover { text-decoration: underline; }" & VbCrLf)
        Response.Write("        h1 { font-family: arial, helvetica, sans-serif; font-size: 18pt; font-weight: bold;}" & VbCrLf)
        Response.Write("        h2 { font-family: arial, helvetica, sans-serif; font-size: 14pt; font-weight: bold;}" & VbCrLf)
        Response.Write("        body, td { font-family: arial, helvetica, sans-serif; font-size: 10pt; }" & VbCrLf)
        Response.Write("        th { font-family: arial, helvetica, sans-serif; font-size: 10pt; font-weight: bold; }" & VbCrLf)
        Response.Write("//-->" & VbCrLf)
        Response.Write("</style>" & VbCrLf)
        Response.Write("<TITLE>ASPInfo()</TITLE></HEAD>" & VbCrLf)
        Response.Write("<BODY>" & VbCrLf)
        Response.Write("<DIV align=""center"">" & VbCrLf)
        Response.Write("<TABLE width=""80%"" border=""0"" bgcolor=""#000000"" cellspacing=""1"" cellpadding=""3"">" & VbCrLf)
        Response.Write("        <TR>" & VbCrLf)
        Response.Write("                <TD align=""center"" valign=""middle"" bgcolor=""#FFFFAE""><H3>ASP (" & strASPVersion & ")</H3></TD>" & VbCrLf)
        Response.Write("        </TR>" & VbCrLf)
        Response.Write("</TABLE>" & VbCrLf)
        Response.Write("<BR>" & VbCrLf)
        Response.Write("<HR>" & VbCrLf)
        Response.Write("<BR>" & VbCrLf)
        Response.Write("<H3>Server Variables</H3>" & VbCrLf)
        Response.Write("<TABLE width=""80%"" border=""0"" bgcolor=""#000000"" cellspacing=""1"" cellpadding=""3"">" & VbCrLf)

        For Each strVariable In Request.ServerVariables
                Response.write("        <TR>" & VbCrLf)
                Response.write("                <TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strVariable & "</TH>" & VbCrLf)
                Response.write("                <TD bgcolor=""#FFFFD9"" align=""left"">" & Request.ServerVariables(strVariable) & " </TD>" & VbCrLf)
                Response.write("        </TR>" & VbCrLf)
        Next 'strVariable

        Response.Write("</TABLE>" & VbCrLf)
        Response.Write("<BR>" & VbCrLf)
        Response.Write("<HR>" & VbCrLf)
        Response.Write("<BR>" & VbCrLf)
        Response.Write("<H3>Cookies</H3>" & VbCrLf)
        Response.Write("<TABLE width=""80%"" border=""0"" bgcolor=""#000000"" cellspacing=""1"" cellpadding=""3"">" & VbCrLf)

        For Each strCookie In Request.Cookies
                If Not Request.Cookies(strCookie).HasKeys Then
                        Response.write("<TR>" & VbCrLf)
                        Response.write("<TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strCookie & "</TH>" & VbCrLf)
                        Response.write("<TD bgcolor=""#FFFFD9"" align=""left"">" & Request.Cookies(strCookie) & " </TD>" & VbCrLf)
                        Response.write("</TR>" & VbCrLf)
                Else
                        For Each strKey In Request.Cookies(strCookie)
                                Response.write("<TR>" & VbCrLf)
                                Response.write("<TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strCookie & "(" & strKey & ")</TH>" & VbCrLf)
                                Response.write("<TD bgcolor=""#FFFFD9"" align=""left"">" & Request.Cookies(strCookie)(strKey) & " </TD>" & VbCrLf)
                                Response.write("</TR>" & VbCrLf)
                        Next
                End if
        Next

        Response.write("</TABLE>" & VbCrLf)
        Response.write("<BR>" & VbCrLf)
        Response.write("<HR>" & VbCrLf)
        Response.write("<BR>" & VbCrLf)
        Response.write("<H3>Session Cookies</H3>" & VbCrLf)
        Response.write("<TABLE width=""80%"" border=""0"" bgcolor=""#000000"" cellspacing=""1"" cellpadding=""3"">" & VbCrLf)

        For Each strSession In Session.Contents
                Response.write("<TR>" & VbCrLf)
                Response.write("<TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">" & strSession & "</TH>" & VbCrLf)
                Response.write("<TD bgcolor=""#FFFFD9"" align=""left"">" & Session(strSession) & " </TD>" & VbCrLf)
                Response.write("</TR>" & VbCrLf)
        Next

        Response.write("</TABLE>" & VbCrLf)
        Response.write("<BR>" & VbCrLf)
        Response.write("<HR>" & VbCrLf)
        Response.write("<BR>" & VbCrLf)
        Response.write("<H3>Other variables</H3>" & VbCrLf)
        Response.write("<TABLE width=""80%"" border=""0"" bgcolor=""#000000"" cellspacing=""1"" cellpadding=""3"">" & VbCrLf)
        Response.write("        <TR>" & VbCrLf)
        Response.write("                <TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">Session.sessionid</TH>" & VbCrLf)
        Response.write("                <TD bgcolor=""#FFFFD9"">" & Session.sessionid & "</TD>" & VbCrLf)
        Response.write("        </TR>" & VbCrLf)
        Response.write("        <TR>" & VbCrLf)
        Response.write("                <TH width=""30%"" bgcolor=""#FFFFAE"" align=""left"">Server.MapPath</TH>" & VbCrLf)
        Response.write("                <TD bgcolor=""#FFFFD9"">" & Server.MapPath ("/") & "</TD>" & VbCrLf)
        Response.write("        </TR>" & VbCrLf)
        Response.write("</TABLE>" & VbCrLf)
        Response.write("</DIV>" & VbCrLf)
        Response.write("</BODY>" & VbCrLf)
        Response.write("</HTML>" & VbCrLf)
End Sub
%>