random password
If you need another password for one of those websites, it’s kind of hard to trust yourself, being human. Everybody has their own preference for particular letters /numbers (or numbers / letters), so it’s better to let your computer do the computing of a nice, random password, like the one that was just produced for you at the top right of the screen, under “random password”. You can have your webserver generate a new random password automatically upon every page refresh, using the following code:
< ?php
function createPassword($length) {
$chars = “234567890abcdefghijkmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ”;
$i = 0;
$password = “”;
while ($i < $length) {
$password .= $chars{mt_rand(0,strlen($chars))};
$i++;
}
return $password;
}
$password = createPassword(8);
echo “How about: $password”;
?>