Check.asp
Copy Code code as follows:
<%
''''''''''''''''''''''''''''''''''''
Function ReplaceText (FSTRING,PATRN,REPLSTR)
Set regEx = New RegExp ' establishes a regular expression.
Regex.pattern = Patrn ' Set mode.
Regex.ignorecase = True ' Sets whether case sensitive.
Regex.global = True ' Sets global availability.
ReplaceText = Regex.Replace ("&fString&" "," "&replStr&") ' Replace.
Set regex=nothing
End Function
''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''
Function HTMLEncode (fstring)
Fstring=trim (fstring)
Fstring=replace (FSTRING,CHR (9), "")
Fstring=replace (FSTRING,CHR (13), "")
Fstring=replace (FSTRING,CHR (22), "")
Fstring=replace (FSTRING,CHR), "&") ' & '
Fstring=replace (FSTRING,CHR (32), "") ""
Fstring=replace (FSTRING,CHR (34), "" "" "" "
Fstring=replace (FSTRING,CHR (37), "%") '% '
Fstring=replace (FSTRING,CHR (39), "'") ' "
Fstring=replace (FSTRING,CHR (42), "*") ' "*"
Fstring=replace (FSTRING,CHR (43), "+") ' "+"
Fstring=replace (FSTRING,CHR (44), ",") ' ","
Fstring=replace (FSTRING,CHR) &CHR (45), "--" ""--"
Fstring=replace (FSTRING,CHR (92), "\") ' "\"
' Fstring=replace (FSTRING,CHR (95), "_") ' "_"
Fstring=replace (FSTRING,CHR (40), "(") ' "("
Fstring=replace (FSTRING,CHR (41), ")") "
Fstring=replace (FSTRING,CHR), "<") ' < '
Fstring=replace (FSTRING,CHR), ">") ' > '
Fstring=replace (FSTRING,CHR (123), "{") ' "{"
Fstring=replace (FSTRING,CHR (125), "}") ' "}"
Fstring=replace (FSTRING,CHR (59), ";") '; '
Fstring=replace (FSTRING,CHR), "<br>"
Fstring=replacetext (Fstring, "([&#])" ([a-z0-9]*); "," $1$2; ")
Fstring=replacetext (Fstring, "(Fuck|shit)", String (Len ("&$1&"), "*")
If Issqldatabase=0 then ' filter Katakana (Japanese characters) [\u30a0-\u30ff] by Yuzi
Fstring=escape (fstring)
Fstring=replacetext (Fstring, "%u30 ([a-f][0-f])", "0$1;"
Fstring=unescape (fstring)
End If
Htmlencode=fstring
End Function
''''''''''''''''''''''''''''''''''''
''''''''''''''''''''''''''''''''''''
Function Requestint (fstring)
Requestint=request (fstring)
If IsNumeric (requestint) Then
Requestint=int (Requestint)
Else
Requestint=0
End If
End Function
''''''''''''''''''''''''''''''''''''
Username=htmlencode (unescape) (Request.QueryString ("UserName"))
Usernamelength=requestint ("Usernamelength")
If Len (UserName) <>usernamelength Then
Response.Write "User name is illegal! "
Else
Response.Write "User name is legal! "
End If
%>
The HTMLEncode function is the necessary step to convert a user name to a legitimate character.
The Requestint function mainly determines whether a user name contains spaces based on the number of valid characters entered.
Call method: Check.asp? Username= username &usernamelength= User name length
Check.asp is generally used for AJAX judgments