Random Password problem

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I am using this php in order to create, store and send random passwords to people who want to join my mailing list.

<?php
function random_password () {
$seed = (integer) md5(microtime());
mt_srand($seed);
$password = mt_rand(1,99999999);
$password = substr(md5($password), 3,9);
return $password;
}
?>

<?php
$msg = random_password();
echo $msg;
?>

I seem to be getting the same number very often which makes me fear that this is not so random. I am a noob so I do not know if this is coincidence or a fault in my coding.
Right now, I have been setting up passwords manually, but would like users to be as free from me as possible. Any direction would be helpful.


BTW, I keep getting the following number an absurd amount of times. I have deleted cookies and even gone to other machines, and yet it still generates this number.

8f31a3

Thank you,
jozef

--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php


[Index of Archives]     [PHP Home]     [PHP Users]     [Postgresql Discussion]     [Kernel Newbies]     [Postgresql]     [Yosemite News]

  Powered by Linux