Re: Validation class method

From: Date: Thu, 06 Jun 2002 19:48:17 +0000
Subject: Re: Validation class method
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-6758@lists.php.net to get a copy of this message
On Thu, 6 Jun 2002, Pierre-Alain Joye wrote: > On Thu, 6 Jun 2002 11:33:44 -0500 (CDT) > Brent Cook <busterb@mail.utexas.edu> wrote: > > > Probably not. I'm looking here for more info. Perhaps this could be a > > little less trivial. > The non trivial part is the middle 2 digits. You have to know the > highest number for each ssn area. This number is monthly publised by > SSA, so it s maybe difficult to keep it updated. > > check the official ;) : > http://www.cpsr.org/cpsr/privacy/ssn/ssn.structure.html > > > > > > - Brent > > pa Here is a script to convert the list of high SSN numbers from the SSA website into a PHP array. Well, it actually generates the code for a PHP array, which could be loaded by a validation function very quickly. I'm working on the validator now. <?php $document = implode('', file('http://www.ssa.gov/foia/highgroup.htm')); $search = array ("'<script[^>]*?>.*?</script>'si", // Strip out javascript "'<[\/\!]*?[^<>]*?>'si", // Strip out html tags "'([\r\n])[\s]+'", // Strip out white space "'&#(\d+);'e"); // evaluate as php $replace = array ("", "", "\\1", "chr(\\1)"); $text = explode("\n", str_replace ('*','', preg_replace ($search, $replace, $document))); $buffer = '<?php $valid_ssn_list=array('; foreach ($text as $line) { $line = trim($line); if ((strlen($line) == 3) && is_numeric($line)) { $buffer .= "$line=>"; } elseif ((strlen($line) == 2) && is_numeric($line)) { $buffer .= "$line,"; } } $buffer .= '); ?>'; print ($buffer); ?>

« previous php.pear.dev (#6758) next »