Mercurial > hg > ywww
comparison user/passGen.php @ 6:077b0a0a3e6d
remaining originals according to dependency walk
| author | Robert Boland <robert@markup.co.uk> |
|---|---|
| date | Thu, 16 Feb 2017 22:29:02 +0000 |
| parents | |
| children |
comparison
equal
deleted
inserted
replaced
| 5:55445b456ad0 | 6:077b0a0a3e6d |
|---|---|
| 1 <?php | |
| 2 | |
| 3 function generatePassword($length=9) { | |
| 4 $vowels = 'aeuy'; | |
| 5 $consonants = 'bdghjmnpqrstvz'; | |
| 6 $consonants .= 'BDGHJLMNPQRSTVWXZ'; | |
| 7 $vowels .= "AEUY"; | |
| 8 $consonants .= '23456789'; | |
| 9 $consonants .= '@#$%'; | |
| 10 | |
| 11 $password = ''; | |
| 12 $alt = time() % 2; | |
| 13 for ($i = 0; $i < $length; $i++) { | |
| 14 if ($alt == 1) { | |
| 15 $password .= $consonants[(rand() % strlen($consonants))]; | |
| 16 $alt = 0; | |
| 17 } else { | |
| 18 $password .= $vowels[(rand() % strlen($vowels))]; | |
| 19 $alt = 1; | |
| 20 } | |
| 21 } | |
| 22 return $password; | |
| 23 } | |
| 24 | |
| 25 ?> |
