RE: [PHP] random letter/character?[Scanned]
| From: | Jon Haworth | Date: | Wed, 19 Mar 2003 14:22:41 +0000 |
| Subject: | RE: [PHP] random letter/character?[Scanned] | ||
| Groups: | php.general | ||
| Request: | Send a blank email to php-general+get-140282@lists.php.net to get a copy of this message | ||
Hi,
> function gen_password($length = 8) {
>
> $chars =
"abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789";
[snip]
Just as a tip - if you want to save hassle for yourself and your users,
remove the following characters from that string:
- 1 (number one)
- l (lower-case letter L)
- I (upper-case letter I)
- 0 (number zero)
- O (upper-case letter O)
These often look the same (for instance, in Courier New at 9pt, 1/l and 0/O
are pixel-perfect matches of each other) and can cause major confusion
amongst less technically gifted users :-)
Cheers
Jon