/ Published in: PHP
Expand |
Embed | Plain Text
Copy this code and paste it in your HTML
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; }
URL: http://www.webtoolkit.info/php-random-password-generator.html