Recommended: Asp object creation and Chinese display solution skills 1. Tips for creating objects in ASP. When we use server components to create objects, there are generally two methods. The most commonly used method is to use the CreateObject() method of the SERVER object, like this: SET NextLink = Server.CreateObject(MSWC
This article is not original, but is just compiled by two or three articles.
If we want to verify whether the ID number is correct, we must first understand the meaning of the ID number.
What does the ID number mean?
1. The structure of the number
The citizenship number is a feature combination code, consisting of a seventeen-digit ontology code and a one-digit verification code. The arrangement order is from left to right: six-digit address code, eight-digit date of birth code, three-digit sequence code and one-digit verification code.
2. Address code (first six digits)
The administrative division code of the county (city, banner, district) where the permanent residence of the coding object is located shall be implemented in accordance with the provisions of GB/T2260.
3. Date of birth code (7th to 14th digits)
It indicates the year, month and day of the birth of the encoded object. It shall be executed according to the provisions of GB/T7408. There is no separator between the year, month and day codes.
4. Sequence code (fifth to seventeenth digits)
It indicates that within the area identified by the same address code, the sequence number assigned to people born in the same year, month, and day. The odd number of the sequence code is assigned to men and even numbers are assigned to women.
5. Verification code (eighteenth digit)
(1) The weighted sum formula for the ontology code of seventeen digits
S = Sum(Ai * Wi), i = 0, ... , 16, first sum of weights of the first 17 digits
Ai: indicates the number value of the ID card number at the i-th position
Wi: represents the weighting factor at the i-th position
Wi: 7 9 10 5 8 4 2 1 6 3 7 9 10 5 8 4 2
(2) Calculation mode
Y = mod(S, 11)
(3) Obtain the corresponding verification code through the module
Y: 0 1 2 3 4 5 6 7 8 9 10
Verification code: 1 0 X 9 8 7 6 5 4 3 2
So we can roughly write a function to verify whether it is correct.
The ASP code function for verifying the ID number is as follows
Code copy box
| Function IDCheck(e)IDCheck = truearrVerifyCode = 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= There are 15 codes or 18-digit ID card number IDCheck = FalseExit FunctionEnd IfDim AiIf Len(e) = 18 ThenAi = Mid(e, 1, 17)ElseIf Len(e) = 15 ThenAi = eAi = Left(Ai, 6) & 19 & Mid(Ai, 7, 9)End IfIf Not IsNumeric(Ai) Then'IDCheck= The ID card must be a number except for the last digit! IDCheck = FalseExit FunctionEnd IfDim strYear, strMonth, strDaystrYear = 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) ThenIf DateDiff(yyyy,Now,BirthDay)<-140 or cdate(BirthDay)>date() Then'IDCheck= Identity card entered incorrectly! IDCheck = FalseExit FunctionEnd IfIf strMonth > 12 Or strDay > 31 ThenIDCheck = False'IDCheck= Identity card entered incorrectly! Exit FunctionEnd IfElse'IDCheck= Identity card entered incorrectly! IDCheck = FalseExit FunctionEnd IfDim i, TotalmulAiWi = 0 To 16TotalmulAiWi = TotalmulAiWi CInt(Mid(Ai, i 1, 1)) * Wi(i)NextDim modValuemodValue = TotalmulAiWi Mod 11Dim strVerifyCodestrVerifyCode = arrVerifyCode(modValue)Ai = Ai & strVerifyCodeIDCheck = AiIf Len(e) = 18 And e <> Ai Then'IDCheck= Identity card number entered incorrectly! IDCheck = FalseExit FunctionEnd IfEnd Function |
In addition, if you can do relevant verification based on the region and birthday filled in by the user, it will be even more perfect. There is basically no way to fill in this number incorrectly. Ha ha. Unless you fill in the accurate information and ID number of others
Share: ASP Q&A Solution to the ASP script running timeout I'm learning server knowledge recently. Sometimes I encounter an error in which the asp script runs timeout, which is really troublesome. I found relevant information, and there are some solutions. The default script timeout of IIS is 90 seconds. If you upload software or transfer data more than 90 seconds.