ASP functions that prohibit automatic spam enrollment members

Source: Internet
Author: User
Tags exit trim
function | member

Ways to prohibit garbage registration

Public Function Checknum (STR)
If str= "" Then Exit Function
If session (STR) =false Then
RanDomize Timer
Session (STR) =int (rnd*9) +1
End If
Checknum=session (STR)
End Function
Function Validinteger (str)
If str= "" Then Exit Function
Dim Re,chkstr
Set re=new REGEXP
Re. IgnoreCase =true
Re. Global=true
Re. Pattern= "[^_\.0-9\d]"
Validinteger=true
Chkstr=re. Replace (Str, "")
Validinteger=isinteger (CHKSTR)
End Function
Public Function Isinteger (Para)
If para= "" Then Exit Function
Isinteger=false
If Not (IsNull (Para) or Trim (Para) = "" Or not IsNumeric (Para)) Then Isinteger=para
' Isinteger=true
' End If
End Function

Verify

Inspect=validinteger (Request.Form ("inspect"))
If Inspect<>trim (Checknum ("N1") +checknum ("N2")) or (IsEmpty ("Checknum")) N1
Response.Write "<script>alert (' you enter a registration validation error, use a half-angle input method to enter two number of and '); History.back ();</script>"
Response. End ()
End If
Session ("N1") =false:session ("N2") =false ' elimination Verification code

Show Page

<%=checknum ("N1") & "+" &checknum ("N2")%>= <input "name=" Inspect "text" type= "2" size= "2"/ >



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.