/[LeafOK_CVS]/fenglin/lib/verify_id_card.inc.php
ViewVC logotype

Annotation of /fenglin/lib/verify_id_card.inc.php

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.2 - (hide annotations)
Fri Mar 28 05:52:03 2025 UTC (11 months, 2 weeks ago) by sysadm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.1: +0 -0 lines
FILE REMOVED
Remove legacy code

1 sysadm 1.1 <?
2     function VerifyIDCard($str)
3     {
4     $iS = 0;
5     $iW = array(7,9,10,5,8,4,2,1,6,3,7,9,10,5,8,4,2);
6     $verCode = array('1','0','X','9','8','7','6','5','4','3','2');
7    
8     if (strlen($str) != 18)
9     return -1; //Invalid string length
10    
11     for ($i=0;$i<17;$i++)
12     {
13     $iS += intval($str[$i] - '0') * $iW[$i];
14     }
15    
16     $iY = $iS % 11;
17    
18     if ($verCode[$iY] != $str[17])
19     return 1; //Invalid card number
20    
21     return 0; //Verify OK
22     }
23     ?>

webmaster@leafok.com
ViewVC Help
Powered by ViewVC 1.3.0-beta1