Could anyone give me some help on functions?
I have the following code which I picked up from someone, which is meant to make pronouncable passwords.
My problem is, I don't know how to execute the function.
Can anyone help?
Thanks,Code:<? $base_a1 = "aeiouy"; $base_a2 = "bcdfghjklmnpqrstvwxz"; $base_0 = "0123456789"; function generate($name_length=8, $name_base=1) { // name_base = 1 - alfa, 2 - num. global $base_a1,$base_a2,$base_0; $retval = ''; mt_srand((double)microtime()*1000000); switch ($name_base) { case 1: { $sw=false; for ($p=0;$p<$name_length;$p++) { if ($sw) $retval .= substr($base_a1,mt_rand(0,strlen($base_a1)-1),1); else $retval .= substr($base_a2,mt_rand(0,strlen($base_a2)-1),1); $sw=!$sw; } break; } case 2: { for ($p=0;$p<$name_length;$p++) $retval .= substr($base_0,mt_rand(0,strlen($base_0)-1),1); break; } } return $retval; } ?>
AJ






Bookmarks