RE: [PHP] random letter/character?[Scanned]

From: Date: Wed, 19 Mar 2003 13:10:40 +0000
Subject: RE: [PHP] random letter/character?[Scanned]
References: 1  Groups: php.general 
Request: Send a blank email to php-general+get-140277@lists.php.net to get a copy of this message
BTW, This is one of the functions I use you might find it helpful in trimming down your function. function gen_password($length = 8) { $chars = "abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ0123456789"; for($i = 0; $i < $length; $i++) { $x = rand(0, strlen($chars) -1); $password .= $chars{$x}; } return $password; } > Hope this helps - I also hope anybody else is fairly gentle with their criticisms and pointers > to whatever is wrong with the script - this is the first time I've ventured to include > something like this in a response to an email on the list :-( > Peer review is the best way we can improve our programming. It is good to post code so that we can all get a better understanding of better techniques and tricks. Regards, AW -- Abdul-Wahid Paterson Lintrix Networking & Communications ltd. Web: http://www.lintrix.net/ Tel: +44 7801 070621 Email/Jabber: aw@lintrix.net -------------------------------------------------------------------- Web-Hosting | Development | Security | Consultancy | Domains --------------------------------------------------------------------

Attachment: [application/pgp-signature] This is a digitally signed message part signature.asc
« previous php.general (#140277) next »