Zend - The PHP Company




Passwords

Add Code


Random Pronounceable Password Generator  

Type: code fragment
Added by: Rival7
Entered: 13/07/2000
Last modified: 08/12/1999
Rating: **** (16 votes)
Views: 15038
This function generates random pronounceable passwords. (ie jachudru, cupheki)


<?

/* Generate password. (i.e. jachudru, cupheki) */
function genpassword($length){

    
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($password0$length);
}


?>


Usage Example


include("genpassword.function")
echo genpassword(10);

(ie jachudru, cupheki)


Rate This Script





Search



This Category All Categories