PHP random password generator


SUBMITTED BY: Guest

DATE: Oct. 23, 2013, 7:13 a.m.

FORMAT: PHP

SIZE: 690 Bytes

HITS: 989

  1. <?php
  2. /**
  3. * The letter l (lowercase L) and the number 1
  4. * have been removed, as they can be mistaken
  5. * for each other.
  6. * Tito code :eyeswideshut25@hotmail.com
  7. */
  8. function createRandomPassword() {
  9. $chars = "abcdefghijkmnopqrstuvwxyz023456789";
  10. srand((double)microtime()*1000000);
  11. $i = 0;
  12. $pass = '' ;
  13. while ($i <= 7) {
  14. $num = rand() % 33;
  15. $tmp = substr($chars, $num, 1);
  16. $pass = $pass . $tmp;
  17. $i++;
  18. }
  19. return $pass;
  20. }
  21. // Usage
  22. //$password = createRandomPassword();
  23. //echo "Your random password is: $password";
  24. ?>

comments powered by Disqus