note 31195 deleted from function.rand by alindeman
| From: | alindeman@php.net | Date: | Sat, 12 Apr 2003 22:55:04 +0000 |
| Subject: | note 31195 deleted from function.rand by alindeman | ||
| References: | 1 | Groups: | php.notes |
| Request: | Send a blank email to php-notes+get-46556@lists.php.net to get a copy of this message | ||
Well, since everyone else is throwing in their password generation toys :P
This one will build a password out of two random words, but could be simply extended to do as many
as you like.
function password()
{
$firstwords = array('Red', 'Green', 'Yellow', 'Blue',
'Orange'); //... do lots to generate more unique passwords.
$secondwords = array('Cabbage', 'Computer', 'Glass', 'Cow',
'Camal');
$firstmax = count($firstwords)-1;
$secondmax = count($secondwords)-1;
$password = $firstwords[rand(0, $firstmax)].$secondwords[rand(0, $secondmax);
return $password;
}
This will generate passwords like BlueComputer, and RedCabbage, which users are more likely to
remember long enough to change it to something else (or keep it... my usual password was generate
along these lines by Yahoo Mail several years ago).
Jon