Jump to content

Random Password


supertrucker

Recommended Posts

Is there a way to create a random five character string? I'm working on a "Forgot Password" page, and need to create a five character random password. Any help would be much appreciated, thanks!ST

Link to comment
Share on other sites

function generate_password ($len){  $user_pw = '';  while (strlen($user_pw) < $len)  {	$char = mt_rand(49, 122);	if (($char > 57 && $char < 65) ||		($char > 90 && $char < 97))	{	  continue;	}	$user_pw .= chr($char);  }  return $user_pw;}

Link to comment
Share on other sites

Thank you very much, just what I was looking for!

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...