Full-service Internet Marketing & Web Development
Recent Posts

Sponsors
![]() |
Secure password generatorCode Wizard, 12-30-2006 |
Generates a random 8 digit password using letters as well as numbers.
I use this for generating VERY random passwords for my system management utility. If people use passwords such as "Zj4Hf83A" or "A94J3ha1" then your system will be much more secure than passwords such as "sex" or "mydaughtersname". You can change $possiblechars to contain whatever you want it to (such as the -, or _, etc.)
function GenPassword() {
$possiblechars = "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrsturv wxyz1234567890";
srand((double)microtime()*1000000);
$rnd1 = rand(0, count($possiblechars));
$letter1 = $possiblechars[$rnd1];
srand((double)microtime()*1000000);
$rnd2 = rand(0, count($possiblechars));
$letter2 = $possiblechars[$rnd2];
srand((double)microtime()*1000000);
$rnd3 = rand(0, count($possiblechars));
$letter3 = $possiblechars[$rnd3];
srand((double)microtime()*1000000);
$rnd4 = rand(0, count($possiblechars));
$letter4 = $possiblechars[$rnd4];
srand((double)microtime()*1000000);
$rnd5 = rand(0, count($possiblechars));
$letter5 = $possiblechars[$rnd5];
srand((double)microtime()*1000000);
$rnd6 = rand(0, count($possiblechars));
$letter6 = $possiblechars[$rnd6];
srand((double)microtime()*1000000);
$rnd7 = rand(0, count($possiblechars));
$letter7 = $possiblechars[$rnd7];
srand((double)microtime()*1000000);
$rnd8 = rand(0, count($possiblechars));
$letter8 = $possiblechars[$rnd8];
$newpwd = "$letter1$letter2$letter3$letter4$letter5$letter6$ letter7$letter8";
return $newpwd;
}
|
|
Subscribe Now to receive new posts via Email as soon as they come out.
Comments
Post your comments

