Way to generate Passwords
| From: | Jochen Kaechelin | Date: | Fri, 02 Mar 2001 03:29:15 +0000 |
| Subject: | Way to generate Passwords | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-42276@lists.php.net to get a copy of this message | ||
i built a script to generate passwords:
function passwort($laenge)
{
$allowed =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ01234567890:-+=";
$allowed_length = strlen($allowed);
$i=0;
$pw = "";
while ($i<$laenge) {
$pos = rand(0,$allowed_length);
$pw.= substr($allowed,$pos,1);
$i++;
}
return $pw;
}
My questions is, if this is a good or bad way?
--
Ihr WEBberater
Stuttgarter Str.3, D-73033 Goeppingen
Tel. +49(0)7161-929594 - Fax. +49(0)7161-929598
http://www.wa-p.de ** mailto:jk@wa-p.de