Location: PHP

Create a random password - PHP function

Create a random password - PHP function
Simple code in PHP that created a random password

//a function that generates a random password

private function createRandomPassword()
{
	$chars = "abcdefghijkmnopqrstuvwxyz023456789";

	srand((double)microtime()*1000000);

	$i = 0;
	$pass = '' ;

	while ($i <= 7)
	{
		$num = rand() % 33;
		$tmp = substr($chars, $num, 1);
		$pass = $pass . $tmp;
		$i++;
	}

	return $pass;
}

Rate:  Be the first to Rank

Add To Facebook Share on Twitter Add To Google Bookmarks Add To Linkedin Add To Del.icio.us Add To digg Add To Stumble Upon Add To Yahoo My Web Add To Technorati