I have used the following function to generate a random password, but it just generates the same string - over and over. What's wrong?
function makepassword($length = 5)
{
// purpose: return a random password of length $length
srand( (double) microtime() );
$which = "";
$password = "";
for ($i=0; $i < $length; $i++) {
$which = rand(1, 3);
// character will be a digit 2-9
if ( $which == 1 ) $password .= rand(0,9);
// character will be a lowercase letter
elseif ( $which == 2 ) $password .= chr( rand(65, 90) );
// character will be an uppercase letter
elseif ( $which == 3 ) $password .= chr( rand(97, 122) );
}
return $password;