ASP form verification

zhaozj2021-02-16  132

<% '================================================ == 'LONZ universal function' ============================================= ======

'String length of Chinese characters Function Strlen (STR) DIM P_LEN P_LEN = 0 Strlen = 0 if Trim (STR) <> "" "THEN P_LEN = LEN (TRIM (STR)) for xx = 1 to p_len if ASC (MID) Str, XX, 1)) <0 THEN STRLEN = INT (STRLEN) 2 else strlen = int (strlen) 1 end if next end if end function

'The maximum number of characters; over returns true, otherwise returns false; maxnum: The maximum number of characters, strmaxnum: character function bymaxnum (maxnum, strmaxnum) if len (strmaxnum)> maxnum then bymaxnum = true else bymaxnum = false end ifend function

'Minimum number of characters; more than returning true, otherwise returning false; maxnu: maximum number, strMaxnum: character function byminnum (minnum, strminnum) if len (strminnum)

'Check the input is not all or not Chinese characters, return true, otherwise return falsefunction isnot (strcs) DIM getcs for cp = 1 to Len (strcs) getcs = MID (STRCS, CP, 1) IF ASC (GETCS)> = 0 THEN ISNOTCS = True EXIT FUNCTION END IF ISNOTCS = FALSE NEXTEND FUNCTION

'Is it a non-email address; returning true for a non-email address, otherwise returns false; judgment condition: Whether to contain "@" Function ISNOTEMAIL (Email)

DIM Names, Name, I, Cisnotemail = Falsenames = Split (email, "@") ife (names) <> 1 dam snotdemail = true exit functionEND IFOR EACH NAME IN NAMES IN (NAME) <= 0 damnotemail = true Exit function end if for i = 1 to len (name) c = lcase (MID (Name, I, 1)) IF INSTR ("AbcdefghijklmnopqrStuvwxyz_-.", c) <= 0 and not isnumeric (c) Then ISNOTEMAIL = True EXIT FUNCTION END IF NEXT IF LEFT (Name, 1) = "." or Right (Name, 1) = "." THEN ISNOTEMAIL = TRUE EXIT FUNIT FUNCTION END IFNEXTIF INSTR (Names (1), ".") <= 0 THEN ISNOTEMAIL = True EXIT FUNCTIONEND IFI = LEN (Names (1)) - Instrrev (Names (1), ".") IF i <> 2 and i <> 3 Then ISNOTEMAIL = true exit functionend IFIF INSTR (email, ".. ")> 0 Then ISNOTEMAIL = TrueEnd IF

END FUNCTION

'Contains illegal characters; only English letters, numbers, "-", "_", "." Function HaveSpchar (Strspchar) HAVESPCHAR = FALSE DIM SP, CSP for sp = 1 to len (strspchar) CSP = LCASE (MID) STRSPCHAR, SP, 1)) IF INSTR ("Abcdefghijklmnopqrstuvwxyz_-.", csp) <= 0 and not isnumeric (CSP) THEN HAVESPCHAR = True Exit function end if nextend full cash>

转载请注明原文地址:https://www.9cbs.com/read-8362.html

New Post(0)