Re: Regular Expression Help: genreate alphanumeric, 8 chars
| From: | Adam i Agnieszka Gasiorowski FNORD | Date: | Thu, 27 Nov 2003 14:53:54 +0000 |
| Subject: | Re: Regular Expression Help: genreate alphanumeric, 8 chars | ||
| References: | 1 2 3 4 | Groups: | php.general |
| Request: | Send a blank email to php-general+get-171215@lists.php.net to get a copy of this message | ||
David T-G wrote:
> Bogdan --
>
> ...and then Bogdan Stancescu said...
> %
> % ...as in...
> %
> % <?
> % // Could've been done with ASCII sets, but this way
> % // you can easily tweak the eligible characters.
> % $eligible='abcdefghijklmnopqrstuvwxyz0123456789';
> % $pwdLen=8;
> % $password='';
> % for($i=0;$i<$pwdLen;$i++) {
> % $password.=$eligible[rand(0,strlen($eligible))];
> % }
> % echo("Your new password: $password\n");
> % ?>
>
> Looks good to me. You're too kind; I was going to leave the exercise to
> the student to complete :-)
How about,
$password = strtolower(substr(md5(uniqid(time())), 0, 7));
Will get you a unique password consisting of 8
rather random lowercase alphanumerics.
--
Seks, seksić, seksolatki... news:pl.soc.seks.moderowana
http://hyperreal.info { iWanToDie } WiNoNa ) (
http://szatanowskie-ladacznice.0-700.pl
foReVeR( * )
Poznaj jej zwiewne kształty... http://www.opera.com 007