01-23-2009, 11:01 PM
[eluser]NBrepresent[/eluser]
I found this code on a snippet site, I didn't write it and I don't know who did. But maybe it would be a neat addition to your library:
I found this code on a snippet site, I didn't write it and I don't know who did. But maybe it would be a neat addition to your library:
Code:
<?
/* Generate password. (e.g. jachudru, cupheki) */
function pronounceable_password($length){
$password = '';
srand((double)microtime()*1000000);
$vowels = array("a", "e", "i", "o", "u");
$cons = array("b", "c", "d", "g", "h", "j", "k", "l", "m", "n", "p", "r", "s", "t", "u", "v", "w", "tr",
"cr", "br", "fr", "th", "dr", "ch", "ph", "wr", "st", "sp", "sw", "pr", "sl", "cl");
$num_vowels = count($vowels);
$num_cons = count($cons);
for($i = 0; $i < $length; $i++){
$password .= $cons[rand(0, $num_cons - 1)] . $vowels[rand(0, $num_vowels - 1)];
}
return substr($password, 0, $length);
}
?>