ASP ID card verification

xiaoxiao2021-03-05  27

Function IDCheck (e)

IDCHECK = TRUE

ArrverifyCode = Split ("1,0, x, 9, 8, 7, 6, 5, 4, 3, 2", ",")

Wi = split ("7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2", ",")

Checker = split ("1, 9, 8, 7, 6, 5, 4, 3, 2, 1, 1", ",")

IF LEN (E) <15 or Len (e) = 16 or Len (e) = 17 or Len (e)> 18 THEN

'Idcheck = "ID number is 15 yards or 18" "

IDCHECK = FALSE

EXIT FUNCTION

END IF

DIM AI

IF LEN (E) = 18 THEN

Ai = MID (e, 1, 17)

Elseif Len (e) = 15 THEN

Ai = e

Ai = Left (Ai, 6) & "19" & MID (ai, 7, 9)

END IF

IF not isnumeric (ai) THEN

'Idcheck = "ID card must be numbers in addition to the last one!"

IDCHECK = FALSE

EXIT FUNCTION

END IF

Dim Stryear, Strmonth, StRDAY

Stryear = CINT (MID (AI, 7, 4))

Strmonth = CINT (MID (AI, 11, 2))

STRDAY = CINT (MID (AI, 13, 2))

BIRTHDAY = Trim (Stryear) "-" Trim (Strmonth) "-" Trim (strday)

IF isdate (birthday) THEN

If Datediff ("YYYY", NOW, BIRTHDAY <- 140 or cdate (birthday)> Date () THEN

'Idcheck = "ID card input error!"

IDCHECK = FALSE

EXIT FUNCTION

END IF

IF strMonth> 12 or strday> 31 THEN

IDCHECK = FALSE

'Idcheck = "ID card input error!"

EXIT FUNCTION

END IF

Else

'Idcheck = "ID card input error!"

IDCHECK = FALSE

EXIT FUNCTION

END IF

DIM I, TOTALMULAIWI

For i = 0 TO 16

Totalmulaiwi = Totalmulaiwi CINT (MID (Ai, I 1, 1)) * Wi (i)

NEXT

DIM MODVALUE

MODVALUE = Totalmulaiwi MOD 11

DIM STRVERIFYCODE

StrverifyCode = ArrverifyCode (MODVALUE)

Ai = AI & STrVERIFYCODE

IDCHECK = ai

IF LEN (E) = 18 and E <> ai then

'Idcheck = "ID number input error!" IDCHECK = FALSE

EXIT FUNCTION

END IF

END FUNCTION

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

New Post(0)