unlike many passwords today, passwords i have thought of in the past havent contained numbers or symbols such as ()!"£$%&*
which would make it easier to hack or guess
i want to adapt a simple random password generator, to return a password which includes a number and one of those symbols mentioned above
now i know i could does this by having a simple 3 part password generator
1 for numbers
1 for letters (upper and lower case)
and 1 for special chars
i wanted to add to the script a function to check to see if the passwod contained a number and a special char
eg.
GtHajeG - would return false, therefore the script would run again to randomise another password
!JhWay2lF - would return true, so the script would echo it
the current script i have is
function rnd_Pass()
{
srand(microtime() * 1000000000000);
$pass_rnd = array('a','b','c',
'd','e','f',
'g','h','i',
'j','k','l',
'm','n','o',
'p','q','r',
's','t','u',
'v','w','x',
'y','z','A',
'B','C','D',
'E','F','G',
'H','I','J',
'K','L','M',
'N','O','P',
'Q','R','S',
'T','U','V',
'W','X','Y',
'Z','0','1',
'2','3','4',
'5','6','7',
'8','9','!',
'"','£','$',
'%','^','&',
'*','(',')');
$rnd = array_rand($pass_rnd, 8);
$password = "";
for($i=0;$i<=7;$i++)
{
$password .=$pass_rnd[$rnd[$i]];
}
return $password;
}
any ideas on how to adapt?!
thanks 😉