MY mENU


Tuesday 20 March 2012

RandomPassWord Creation in PHP

This is a simple random password example , you could generate this for a visitor to use and store it in a database.

function random_password ()
{
$seed = (integer) md5(microtime());
mt_srand($seed);
$password = mt_rand(1,99999999);
$password = substr(md5($password), mt_rand(0, 19), mt_rand(6, 12));
return $password;
}
?>
$msg = random_password();
echo $msg;
?>

No comments:

Post a Comment