Revision: 14110
Initial Code
Initial URL
Initial Description
Initial Title
Initial Tags
Initial Language
at May 19, 2009 11:13 by bgriffiths
Initial Code
function create_key(&$cnnDB){ $letters = range('A','Z'); $numbers = range(0,9); $all = array_merge($numbers,$letters); $foundkey = false; while(!$foundkey){ for($i=0;$i<5;$i++){ $num = rand(0,count($all)-1); $key .= $all[$num]; $total += $num; } //Replace Oh with Zero, I with one $key = str_replace( array('O','I'), array('0','1'), $key ); //make checksum $key .= $all[($total % count($all))]; $key = str_replace( array('O','I'), array('0','1'), $key ); $SQL = 'select C_Key from customers where C_Key = "'.$key.'"'; $result = $cnnDB->GetRow($SQL); if(count($result) == 0){ $foundkey = true; } } return $key; }
Initial URL
Initial Description
Initial Title
Create Unique Code Replacing Lookalike Characters
Initial Tags
code
Initial Language
PHP