try this
function randpassword () {
$length = 6;
srand((double)microtime()*1000000);
$string = '';
while(strlen($string) != $length) {
$type = rand(1,2);
if ($letterammount = 4) {$type = 1;}
if ($numammount = 2) {$type = 2;}
if($type == 1) {
$string = $string . chr(rand(48,57)); //
numbers
$numammount = ($numammount + 1);
}
if($type == 2) {
$lettertype = rand(1,2);
if($lettertype == 1) {$string = $string .
chr(rand(65,90));} // uppercase letters
if($lettertype == 2) {$string = $string .
chr(rand(97,122));} //
lowercase letters
$letterammount = ($letterammount + 1);
}
}
return($string);
}
hope that helps
Regards
Mark Cubitt
> -----Original Message-----
> From: Philip J. Newman [mailto:[EMAIL PROTECTED]
> Sent: 28 March 2003 11:33
> To: [EMAIL PROTECTED]
> Subject: [PHP] Random Password Making.
>
>
> Whats the best way to make a random password with 4 letters and 2 numbers?
>
>
> ------
> Philip J. Newman.
> Head Developer
> [EMAIL PROTECTED]
>
>
> --
> PHP General Mailing List (http://www.php.net/)
> To unsubscribe, visit: http://www.php.net/unsub.php
>
>
>
> ******************************************************************
> ************
> This email has been virus checked by the Eclipse Internet
> MAILsafe service
> ******************************************************************
> ************
> www: http://www.eclipse.net.uk/ email:
> [EMAIL PROTECTED]
> ******************************************************************
> ************
>
>
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php