note 40266 added to function.rand
| From: | ncesar at lunix dot com dot ar | Date: | Thu, 26 Feb 2004 21:21:20 +0000 |
| Subject: | note 40266 added to function.rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-65842@lists.php.net to get a copy of this message | ||
a simple function to generate simple nemonic passwords. adjust 'es' array to your
preference
common users are not so smart some times and they forget passwords like 'JhgtBvX' even
they are very good password for the purist.
<?php
/* Copyright (c) 2004 Nicolas D. Cesar
* mkpasswd is distributed under the terms of
* the GNU General Public License (GNU GPL)
*/
function mkpasswd() {
$es=array('ma', 'be', 'li', 'ro','ne',
'ci', 'mo', 'bu',
'pi', 'no', 'nu', 'va', 'ro',
'du', 'pa', 'de',
'su', 'fa', 'que', 'pin', 'ta',
'je', 'qui', 'go','vu', 'ka');
for ($a = 0 ; $a < 4 ; $a++) {
$ret .= $es[rand(0,sizeof($es))];
}
$ret .= rand(1,99);
return $ret;
}
?>
----
Manual Page -- http://www.php.net/manual/en/function.rand.php
Edit -- http://master.php.net/manage/user-notes.php?action=edit+40266
Delete -- http://master.php.net/manage/user-notes.php?action=delete+40266&report=yes
Reject -- http://master.php.net/manage/user-notes.php?action=reject+40266&report=yes
Search -- http://master.php.net/manage/user-notes.php