Posted By

scottwatkins on 04/19/11


Tagged


Versions (?)

Temporary password in PHP


 / Published in: PHP
 

URL: http://www.go4expert.com/forums/showthread.php?t=269

  1. function randompassword($len)
  2. {
  3. $pass = '';
  4. $lchar = 0;
  5. $char = 0;
  6. for($i = 0; $i < $len; $i++)
  7. {
  8. while($char == $lchar)
  9. {
  10. $char = rand(48, 109);
  11. if($char > 57) $char += 7;
  12. if($char > 90) $char += 6;
  13. }
  14. $pass .= chr($char);
  15. $lchar = $char;
  16. }
  17. return $pass;
  18. }

Report this snippet  

You need to login to post a comment.