PHP Identity Card Authentication

Time:2019-10-6
/ *** Identification Number Verification (Method to Call)*@param $id_card ID Number*/function validation_filter_id_card($id_card){if (strlen ($id_card) == 18) {idcard_base = substr ($id_card, 0, 17); if (idcard_verify_card) = stoupper (substr ($id_card, 17, 1){false;} {return true;}} elseif ((strlen ($id_card) = = 15)) {// if the identity card sequence code is 996997998999, these are special coding if for the elderly over the age of 100 (array_search (substr, $id_card, 12, 3), array ('996', array, elseif)) = {= = ((0, 6)). Otherwise {$id card = substr ($id_card, 0, 6),'19'. substr ($id_card, 6, 9);} $idcard = $idcard. idcard_verify_number ($idcard); if (strlen ($card)!= 18) {false return;} $idcard_base = substr ($card, 0, 17); if (card_verify_number ($idbase) = rtoupper ($idcard) = stpper ($idc) (ard, 17, 1)) {return false;} else {return true;} else {return false;}}} /*** calculates the ID card verification code, according to the national standard GB 11643-1999 * @param $idcard_base ID card number * / function idcard_verify_number ($idcard_base) {if (strlen ($card_base)!= 17) {return false;}// Weight factor $factor = array (7, 9, 9, 10, 5, 5, 8, 4, 2, 1, 6, 6, 3, 3, 7, 7, 9, 10, 5, 5, 8, 8, 6, 6, 6, 6, 6, 6, 6,'0','X','9','9''',,'9''','8','8''7','6'''6'','6''''''','4'''',,,'''''',,,,,'''''''',,,,,,,'''''''''''',,,,,,''''''''''''''',,,,,,,,'''''idcard_base, $i, 1) * $factor [$i];} $mod = $chec Ksum% 11; $verify_number = $verify_number_list [$mod]; return $verify_number;}