note 80156 added to function.mt-rand
| From: | RobDanner at osu1 dot php dot net | Date: | Tue, 01 Jan 2008 16:15:39 +0000 |
| Subject: | note 80156 added to function.mt-rand | ||
| Groups: | php.notes | ||
| Request: | Send a blank email to php-notes+get-134645@lists.php.net to get a copy of this message | ||
Here's a fairly decent password generator of 8 character, easily memorized passwords that use
non-objectionable language. Great for password resets if you tweak it to be unique.
function RandomPassword() {
$sFirstChar = 'bdgjmnrsvwy'; $nMax = strlen($sFirstChar)-1;
$nI1 = mt_rand(0, $nMax);
$sSecondChar = 'aeiou'; $nMax = strlen($sSecondChar)-1;
$nI2 = mt_rand(0, $nMax);
$sThirdChar = 'bdhmnpr'; $nMax = strlen($sThirdChar)-1;
$nI3 = mt_rand(0, $nMax);
$sFourthChar = 'bdhmnpr'; $nMax = strlen($sFourthChar)-1;
$nI4 = mt_rand(0, $nMax);
$sFifthChar = 'aeiou'; $nMax = strlen($sFifthChar)-1;
$nI5 = mt_rand(0, $nMax);
$sSixthChar = 'bdhmnpr'; $nMax = strlen($sSixthChar)-1;
$nI6 = mt_rand(0, $nMax);
$sPass = substr($sFirstChar, $nI1, 1);
$sPass .= substr($sSecondChar, $nI2, 1);
$sPass .= substr($sThirdChar, $nI3, 1);
$sPass .= substr($sFourthChar, $nI4, 1);
$sPass .= substr($sFifthChar, $nI5, 1);
$sPass .= substr($sSixthChar, $nI6, 1);
$sPass .= mt_rand(1,9);
$sPass .= mt_rand(1,9);
return $sPass;
}
----
Server IP: 209.41.74.194
Probable Submitter: 70.109.25.226
----
Manual Page -- http://www.php.net/manual/en/function.mt-rand.php
Edit -- https://master.php.net/note/edit/80156
Del: integrated -- https://master.php.net/note/delete/80156/integrated
Del: useless -- https://master.php.net/note/delete/80156/useless
Del: bad code -- https://master.php.net/note/delete/80156/bad+code
Del: spam -- https://master.php.net/note/delete/80156/spam
Del: non-english -- https://master.php.net/note/delete/80156/non-english
Del: in docs -- https://master.php.net/note/delete/80156/in+docs
Del: other reasons-- https://master.php.net/note/delete/80156
Reject -- https://master.php.net/note/reject/80156
Search -- https://master.php.net/manage/user-notes.php