You are here: Re: Random Password PHP code help req.. only gettinh 3 letters? « PHP Programming Language « IT news, forums, messages
Re: Random Password PHP code help req.. only gettinh 3 letters?

Posted by techcs on 09/14/06 21:44

Hi, thanks for that but I get a parse error with that code, maybe I
have to change some of the other bit to match, will have another
look...

Cheers
Col
Alvaro G. Vicario wrote:
> *** techcs escribió/wrote (14 Sep 2006 12:58:34 -0700):
> > Wondering if anyine can help with the membership PHP script I lifted
> > from a tutorial. I'm new to PHP and have this system up and running but
> > my password only come out at three letters and sometime have a space in
> > them??
>
>
> I'd replace this part...
>
> > $i = 0;
> > while ($i <= $len) {
> > $num = rand() % strlen($salt);
> > $tmp = substr($salt, $num, 1);
> > $pass = $num . $tmp;
> > $i++;
> > };
>
> ... with this code:
>
> $pass='';
> $max=strlen($salt)-1;
> for($i=0; $i<$len); $i++){
> $pass.=$salt{mt_rand(0, $max)};
> }
>
>
> --
> -+ http://alvaro.es - Álvaro G. Vicario - Burgos, Spain
> ++ Mi sitio sobre programación web: http://bits.demogracia.com
> +- Mi web de humor con rayos UVA: http://www.demogracia.com
> --

 

Navigation:

[Reply to this message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация