[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cobalt-users] Password generation.



ben wrote on 21.08.2001:

> I am curious to find out what program is used to generate passwords when a
> new user registers to this forum.
> Anyone have any ideas?

I use the following PHP-function to generate passwords

<?

function FncRandomString($nAnzahl) {
  srand(date("s"));
  $strZeichen = "ABCDEFGHJKLMNPQRSTUVWXYZabcdefghijkmnpqrstuvwxyz123456789123456789";
  $strRandom = "";
  while (strlen($strRandom) < $nAnzahl) {
   $strRandom .= substr($strZeichen,(rand()%(strlen($strZeichen))),1);
  }
  return ($strRandom);
}


echo "Password: " . FncRandomString(6);

?>

6 is the length of the password. There are no 0's O's and o's in the
password since many people don't see the difference between them.

Regards,
Daniel