Snippet Name: Random Pronounceable Passwords
Description: Produces nice random-yet-pronounceable passwords.
Also see: » Random Image from Directory
» Random banner picker
» Generate random string
» Rounded random numbers
» Pick Randomly from Array
» Weighted Random Choice
Comment: (none)
Language: PHP
Highlight Mode: PHP
Last Modified: March 16th, 2009
|
<?PHP
FUNCTION auth_pwgen(){
$pw = '';
$c = 'bcdfghjklmnprstvwz'; //consonants except hard to speak ones
$v = 'aeiou'; //vowels
$a = $c.$v; //both
//use two syllables...
FOR($i=0;$i < 2; $i++){
$pw .= $c[RAND(0, STRLEN($c)-1)];
$pw .= $v[RAND(0, STRLEN($v)-1)];
$pw .= $a[RAND(0, STRLEN($a)-1)];
}
//... and add a nice number
$pw .= RAND(10,99);
RETURN $pw;
}
?> |