PHP password generator


SUBMITTED BY: Guest

DATE: Oct. 23, 2013, 9:14 a.m.

FORMAT: PHP

SIZE: 775 Bytes

HITS: 1008

  1. <?php
  2. function GeneratePassword($length=8, $strength=0){
  3. $vowels = 'aeuy';
  4. $consonants = 'bdghjmnpqrstvz';
  5. if($strength >= 1) $consonants .= 'BDGHJLMNPQRSTVWXZ';
  6. if($strength >= 2) $vowels .= 'AEUY';
  7. if($strength >= 3) $consonants .= '12345';
  8. if($strength >= 4) $consonants .= '67890';
  9. if($strength >= 5) $vowels .= '@#$%';
  10. $password = '';
  11. $alt = time() % 2;
  12. for($i = 0; $i < $length; $i++){
  13. if($alt == 1){
  14. $password .= $consonants[(rand() % strlen($consonants))];
  15. $alt = 0;
  16. }else{
  17. $password .= $vowels[(rand() % strlen($vowels))];
  18. $alt = 1;
  19. }
  20. }
  21. return $password;
  22. }
  23. ?>

comments powered by Disqus