Copy Code code as follows:
' Procedure: Output string [instead of Response.Write]
Sub Echo (STR)
Response. Write (STR)
End Sub
' Function: Get the form [instead of Request.Form]
Function REQF (STR)
REQF = Request.Form (STR)
End Function
' Procedure: End page and output string
Sub die (STR)
Response. Write (STR)
Response. End ()
End Sub
' Function: Return ASP file run result to string
Function ob_get_contents (Path)
Dim tmp, A, B, t, matches, M
Dim STR
STR = File_iread (Path)
TMP = "Dim htm:htm =" "" "&vbcrlf
A = 1
b = InStr (A, Str, "<%") + 2
While B > A + 1
t = Mid (STR, A, b-a-2)
t = Replace (T, VbCrLf, "{:: VbCrLf}")
t = Replace (T, vbcr, "{:: vbcr}")
t = Replace (T, "" "" "" "" "" "")
TMP = tmp & "htm = htm &" "" & T & "" "& VbCrLf
A = InStr (b, Str, "%\>") + 2
TMP = tmp & Str_replace ("^\s*=", Mid (str, B, A-b-2), "htm = htm &") & VbCrLf
b = InStr (A, Str, "<%") + 2
Wend
t = Mid (STR, a)
t = Replace (T, VbCrLf, "{:: VbCrLf}")
t = Replace (T, vbcr, "{:: vbcr}")
t = Replace (T, "" "" "" "" "" "")
TMP = tmp & "htm = htm &" "" & T & "" "& VbCrLf
TMP = Replace (tmp, "Response.Write", "htm = htm &", 1,-1, 1)
TMP = Replace (tmp, "echo", "htm = htm &", 1,-1, 1)
' Execute (TMP)
Executeglobal (TMP)
htm = Replace (htm, "{:: vbCrLf}", vbCrLf)
htm = Replace (htm, "{:: vbcr}", vbcr)
ob_get_contents = htm
End Function
' Procedure: dynamic include file
Sub include (Path)
echo ob_get_contents (Path)
End Sub
' Function: Base64 encryption
Function Base64Encode (ByVal Str)
If IsNull (Str) Then Exit Function
Dim Base64
Set base64 = New Base64_class
str = base64.encode (str)
Set base64 = Nothing
Base64Encode = Str
End Function
' Function: Base64 decryption
Function Base64decode (ByVal Str)
If IsNull (Str) Then Exit Function
Dim Base64
Set base64 = New Base64_class
str = base64.decode (str)
Set base64 = Nothing
Base64decode = Str
End Function
' Function: URL encryption
Function UrlEncode (ByVal Str)
If IsNull (Str) Then Exit Function
STR = Server. UrlEncode (STR)
UrlEncode = Str
End Function
' Function: Escape encryption
Function Escape (ByVal Str)
If IsNull (Str) Then Exit Function
Dim I, C, a, TMP
TMP = ""
For i = 1 to Len (STR)
c = Mid (Str, I, 1)
A = AscW (c)
If (a>= and a<=) or (a>= and a<=) or (a>= and a<= 122) Then
TMP = TMP & C
ElseIf InStr ("@*_+-./", C) > 0 Then
TMP = TMP & C
ElseIf a>0 and A<16 Then
TMP = tmp & "%0" & Hex (a)
ElseIf a>= and a<256 Then
TMP = tmp & "%" & Hex (a)
Else
TMP = tmp & "%u" & Hex (a)
End If
Next
Escape = tmp
End Function
' Function: Escape decryption
Function unescape (ByVal Str)
If IsNull (Str) Then Exit Function
Dim I, C, TMP
TMP = ""
For i = 1 to Len (STR)
c = Mid (Str, I, 1)
If Mid (str, I, 2) = "%u" and i<= Len (str)-5 Then
If isnumeric ("&h" & Mid (STR, i + 2, 4)) Then
TMP = tmp & ChrW (CInt ("&h" & Mid (STR, i + 2, 4))
i = i + 5
Else
TMP = TMP & C
End If
ElseIf C = "%" and i<= Len (STR)-2 Then
If isnumeric ("&h" & Mid (STR, i + 1, 2)) Then
TMP = tmp & ChrW (CInt ("&h" & Mid (STR, i + 1, 2))
i = i + 2
Else
TMP = TMP & C
End If
Else
TMP = TMP & C
End If
Next
unescape = tmp
End Function