Mercurial > hg > ywww
diff user/uk/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 |
line wrap: on
line diff
--- /dev/null Thu Jan 01 00:00:00 1970 +0000 +++ b/user/uk/passGen.php Thu Feb 16 22:29:02 2017 +0000 @@ -0,0 +1,25 @@ +<?php + +function generatePassword($length=9) { + $vowels = 'aeuy'; + $consonants = 'bdghjmnpqrstvz'; + $consonants .= 'BDGHJLMNPQRSTVWXZ'; + $vowels .= "AEUY"; + $consonants .= '23456789'; + $consonants .= '@#$%'; + + $password = ''; + $alt = time() % 2; + for ($i = 0; $i < $length; $i++) { + if ($alt == 1) { + $password .= $consonants[(rand() % strlen($consonants))]; + $alt = 0; + } else { + $password .= $vowels[(rand() % strlen($vowels))]; + $alt = 1; + } + } + return $password; +} + +?> \ No newline at end of file