Copy Code code as follows:
<?php
PHP automatically obtains the corresponding constellation function according to the ID number
function Get_xingzuo ($cid) {//automatically returns the corresponding constellation according to the ID number
if (!isidcard ($cid)) return ";
$bir = substr ($cid, 10,4);
$month = (int) substr ($bir, 0,2);
$day = (int) substr ($bir, 2);
$strValue = ';
if ($month = = 1 && $day >= 20) | | ($month = = 2 && $day <= 18)) {
$strValue = "Aquarius";
else if (($month = 2 && $day >= 19) | | ($month = = 3 && $day <= 20)) {
$strValue = "Pisces";
else if (($month = = 3 && $day > 20) | | ($month = = 4 && $day <= 19)) {
$strValue = "Aries";
else if (($month = 4 && $day >= 20) | | ($month = = 5 && $day <= 20)) {
$strValue = "Taurus";
else if (($month = 5 && $day >= 21) | | ($month = = 6 && $day <= 21)) {
$strValue = "Gemini";
else if (($month = = 6 && $day > 21) | | ($month = = 7 && $day <= 22)) {
$strValue = "cancer";
else if (($month = = 7 && $day > 22) | | ($month = = 8 && $day <= 22)) {
$strValue = "Leo";
else if (($month = 8 && $day >= 23) | | ($month = = 9 && $day <= 22)) {
$strValue = "Virgo";
else if (($month = 9 && $day >= 23) | | ($month = && $day <= 23)) {
$strValue = "Libra";
else if (($month = && $day > 23) | | ($month = && $day <= 22)) {
$strValue = "Scorpio";
else if (($month = && $day > 22) | | ($month = && $day <= 21)) {
$strValue = "Sagittarius";
else if (($month = && $day > 21) | | ($month = = 1 && $day <= 19)) {
$strValue = "Capricorn";
}
return $strValue;
}
function Get_shengxiao ($cid) {///According to the ID number, automatically return the corresponding Zodiac
if (!isidcard ($cid)) return ";
$start = 1901;
$end = $end = (int) substr ($cid, 6,4);
$x = ($start-$end)% 12;
$value = "";
if ($x = = 1 | | $x = = -11) {$value = "mouse";}
if ($x = = 0) {$value = "ox";}
if ($x = = One | | $x = = 1) {$value = "Tiger";}
if ($x = = | | $x = = 2) {$value = "rabbit";}
if ($x = = 9 | | | $x = = 3) {$value = "dragon";}
if ($x = = 8 | | $x = = 4) {$value = "snake";}
if ($x = = 7 | | $x = = 5) {$value = "horse";}
if ($x = = 6 | | | $x = = 6) {$value = "sheep";}
if ($x = = 5 | | $x = = -7) {$value = "monkey";}
if ($x = = 4 | | $x = = -8) {$value = "chicken";}
if ($x = = 3 | | $x = = -9) {$value = "dog";}
if ($x = = 2 | | $x = = -10) {$value = "pig";}
return $value;
}
function Get_xingbie ($cid) {//automatic return of gender according to ID number
if (!isidcard ($cid)) return ";
$sexint = (int) substr ($cid, 16, 1);
return $sexint% 2 = 0? ' Female ': ' Male ';
}
function Isidcard ($number) {//Check whether it is an ID number
Convert to uppercase, if X appears
$number = Strtoupper ($number);
Weighting factor
$wi = Array (7, 9, 10, 5, 8, 4, 2, 1, 6, 3, 7, 9, 10, 5, 8, 4, 2);
Check code strings
$ai = Array (' 1 ', ' 0 ', ' X ', ' 9 ', ' 8 ', ' 7 ', ' 6 ', ' 5 ', ' 4 ', ' 3 ', ' 2 ');
Recycle first 17 bits in sequence
$sigma = 0;
for ($i = 0; $i < $i + +) {
Extract one of the first 17 digits and convert the variable type to real
$b = (int) $number {$i};
Extract the corresponding weighting factor
$w = $wi [$i];
Multiplies a number and weighted factor that is extracted from the ID card number and accumulates
$sigma + + $b * $W;
}
Calculate ordinal
$snumber = $sigma% 11;
Extracts the corresponding characters from the checksum code string by serial number.
$check _number = $ai [$snumber];
if ($number {} = = $check _number) {
return true;
} else {
return false;
}
}
?>
In addition, the verification of the identity card number of the site also provides identity card attribution of the query tools are as follows:
Http://tools.jb51.net/bianmin/sfz