Copy codeThe Code is as follows: 'process: the output string [Replaces Response. Write]
Sub echo (Str)
Response. Write (Str)
End Sub
'Function: Obtain the Form [replacing Request. Form]
Function reqf (Str)
Reqf = Request. Form (Str)
End Function
'Process: end the page and output a string
Sub die (Str)
Response. Write (Str)
Response. End ()
End Sub
'Function: returns the ASP file running result as a 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,)
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
'Process: dynamically include files
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> = 48 And a <= 57) Or (a> = 65 And a <= 90) Or (a> = 97 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 ()
ElseIf a> = 16 And a <256 Then
Tmp = tmp & "%" & Hex ()
Else
Tmp = tmp & "% u" & Hex ()
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