/ Published in: PHP
URL: http://www.webtoolkit.info/php-random-password-generator.html
Expand |
Embed | Plain Text
function generatePassword($length=9, $strength=0) { $vowels = 'aeuy'; $consonants = 'bdghjmnpqrstvz'; if ($strength & 1) { $consonants .= 'BDGHJLMNPQRSTVWXZ'; } if ($strength & 2) { $vowels .= "AEUY"; } if ($strength & 4) { $consonants .= '23456789'; } if ($strength & 8) { $consonants .= '@#$%'; } $password = ''; for ($i = 0; $i < $length; $i++) { if ($alt == 1) { $alt = 0; } else { $alt = 1; } } return $password; }
You need to login to post a comment.
