A random Password Generator script - Full featured
Here is random Password generator function, it can produce complex passwords of any desired length. It can generate passwords which are alpha-numeric + with special characters (optional) + upper and lower case mixed within it.
$possible = '1234567890abcdefghijklmnopqrstuvwxyz';
if($special_char)
$possible .= '!@#$%^&*()_+-=[]{};\':",./\\<>?|`~';
$code = '';
$i = 0;
while ($i < $characters) {
$code1 = substr($possible, mt_rand(0, strlen($possible)-1), 1);
if(rand()%2==0)
$code1= strtoupper($code1);
$code .=$code1;
$i++;
}
return $code;
}
Features of this function:
- Alpha-numeric passwords
- You can get random password of any desired length
- Can produce password of combined upper and lowercase characters.
- Can optionally produce passwords with special characters
Suppose you want to produce password of length 8 characters, then the syntax to call the function is
If you want to create password with special characters also, then the syntax will be
Some examples of generated passwords are:
Mm69lIGf
“)5E%\{7
M4p3OVEod6Dq9cJZMkGZMEnm31JVGcNY8iK
J4j:8~-72)^fF>=6)S<(”{~->a0gQ6(DrEk
If you don’t need a complex passwords generator like this then you can try A simple Password Generator here it is one-line code which can generate simple random passwords.
I appreciate, cause I found exactly what I was looking for. You have ended my four day long hunt! God Bless you man. Have a great day. Bye
Me sorry for my english not so well, but me think that you are write too pointe.