Random Password problem

From: Date: Tue, 08 Mar 2005 19:41:11 +0000
Subject: Random Password problem
Groups: php.db 
Request: Send a blank email to php-db+get-38823@lists.php.net to get a copy of this message
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

« previous php.db (#38823) next »