PHP Extract the birthday date in the ID number and verify whether it is an adult function, ID number adult
PHP extracts the birthday date from the ID number and determines whether a function is adult. Can be determined at the sam
In some personnel information system, may ask to fill in the person's identity card number, but how to verify the format of the ID number is legal? We write the validated SQL as a stored procedure to facilitate repeated calls.First of all, we need to understand the composition of our identity number rules:1, 18-digit ID
This article is not original, but only a combination of two or three articles sorted together.
If we want to verify the correct ID number, we must first understand the meaning of the ID number.
What does the ID number mean?
1, the structure of the numberThe citizenship numbe
PHP: The function used to verify the validity of the ID card. php: The function used to verify the ID card.
For more information, see the code:
Function is_idcard ($ id) {$ id = strtoupper ($
Recent projects used in the need to call the real-name authentication interface, real-name authentication interface price compared to SMS is not a bit higher than a few cents, so that the conditions of the call authentication is strict, so use to JS verify the true name and JS authentication ID number.
Get to the poin
Validata.htm
Copy Code code as follows:
Validata.js
Copy Code code as follows:
$ (function () {
$.validator.setdefaults ({
Submithandler:function (form) {
Form.submit ();
}
});
Character validation
JQuery.validator.addMethod ("Stringcheck", function (value, Element) {
return this.optional (Element) | | /^[\u0391-\uffe5\w]+$/.test (value);
"Can only include Chinese characters, English letters, numbers and underscores");
Two bytes in text
JQuer
QQ Group of brothers asked "who gave me an ID card number to verify the code" Just I also need to find the next code from the Internet, feel good, suitable for 15 and 18 ID card, online good garbage station, are directly collected csdn problem, the answer is no, HanUse JavaScript to
Recent projects used in the need to call the real-name authentication interface, real-name authentication interface price compared to SMS is not a bit higher than a few cents, so that the conditions of the call authentication is strict, so use to JS verify the true name and JS authentication ID number.
Get to the poin
When we do various programming design, we often encounter the need for personnel registration, but the information on the registration of people to verify the means but also
Very ineffective, because it is difficult for us to judge whether a person's information is true or not! We just try to check his message as much as possible.
Now let's take a look at some si
in column C is converted from a text format to a real "date" format. However, careful you should have found that only the correct date can be successfully converted, its alignment automatically turned to "right", and the wrong date is not converted, is still text formatting, alignment is still "left", Adjust column C
Structure of the ID card number
The ID card number is a characteristic combination code, which consists of a 17 digit ontology code and a check code.
Order from left to right according to this: six-digit address code, eight-digit birth date code, three-digit sequential code and a digital parity code.
Address code (top six digits)
The administrative division c
The ID card number is divided into two, the old one is 15 digits, the new one is 18 digits. ID Card 15-bit encoding rule: dddddd yymmdd xx P dddddd: Region code YYMMDD: Date of birth XX: Sequence class code, cannot determine p: sex, odd for male, even for female;
Verify the validity of the ID card number based on the encoding rules. The specific implementation is as follows. You can refer to the following code to verify the validity of the ID card number based on the ID card number encodin
The following is based on the ID number coding rules, using JS to validate the code
The Idcard-validate.js code is as follows:
Copy Code code as follows:
/**
* ID Card 15-bit coding rule: dddddd YYMMDD xx p
* DDDDDD: Area code
* YYMMDD: Date of birth
* XX: Sequential class code, cannot be determined
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.