ASP Ajax registration and verification to prevent spaces in user names

Source: Internet
Author: User

Check. asp CopyCode The Code is as follows: <%
''''''''''''''''''''''''''''''''''''
Function replacetext (fstring, patrn, replstr)
Set RegEx = new Regexp 'to create a regular expression.
RegEx. pattern = patrn 'setting mode.
RegEx. ignorecase = true' is used to set Case sensitivity.
RegEx. Global = true' to set global availability.
Replacetext = RegEx. Replace ("" & fstring & "", "" & replstr & "") 'to 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 (38), "&") '&"
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 (45) & 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 (60), "<") '"<"
Fstring = Replace (fstring, CHR (62), ">") '">"
Fstring = Replace (fstring, CHR (123), "{") '"{"
Fstring = Replace (fstring, CHR (125), "}") '}"
Fstring = Replace (fstring, CHR (59), ";") ';"
Fstring = Replace (fstring, CHR (10), "<br> ")
Fstring = replacetext (fstring, "([]) ([a-z0-9] *);", "$1 $2 ;")
Fstring = replacetext (fstring, "(Fuck | shit)", string (LEN ("& $1 &"),"*"))
If issqldatabase = 0 then' filter katakana (Japanese character) [\ u30a0-\ u30ff] By yuzi
Fstring = escape (fstring)
Fstring = replacetext (fstring, "% u30 ([A-F] [0-f])", "$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 "invalid user name! "
Else
Response. write "the user name is valid! "
End if
%>

The htmlencode function is a required step to convert a user name to a valid character.
The requestint function determines whether the user name contains spaces based on the number of valid characters entered.
Call method: Check. asp? Username = username & usernamelength = username Length
Check. asp is generally used for Ajax judgment.

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.