note 80156 deleted from function.mt-rand by felipe

From: Date: Thu, 03 Jan 2008 01:32:54 +0000
Subject: note 80156 deleted from function.mt-rand by felipe
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-134678@lists.php.net to get a copy of this message
Note Submitter: Rob Danner ---- 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; }

« previous php.notes (#134678) next »