Password Generator PHP Snippet

Add Tool

Password Generator PHP Snippet

Password Generator PHP Snippet

Get stuck attempting to select a brand new watchword every time you signup to a brand new service or web site. the majority do use constant watchword on each web site that they're going to however this could be dangerous if one site gets hacked then your watchword can be used on all the sites you often use. Therefore for best security reason you must use a unique watchword for various websites and there area unit several watchword management tools out there that may assist you bear in mind all of your passwords. So if you're having to concoct new passwords every time you check in to a web site you may run out of concepts of what to place and begin making simply something. however some websites have watchword strength needs, like it's to own a minimum of one range, or one graphic symbol.

Password Strength

The below Password Generator PHP Snippet can generate a watchword for you and you'll be able to customize it to an explicit level of watchword strength of Password Generator PHP Snippet.

  • If the strength is quite one then capitals area unit enclosed.
  • If the strength is quite two then capital vowels area unit enclosed.
  • If the strength is quite four then numbers area unit enclosed.
  • Finally if the strength is quite eight then special characters area unit enclosed.

I notice that a watchword strength of additional then four is nice enough for many websites.

function generatePassword($length=9, $strength=0) {
$vowels = 'aeuy';
$consonants = 'bdghjmnpqrstvz';
if ($strength >= 1) {
$consonants .= 'BDGHJLMNPQRSTVWXZ';
if ($strength >= 2) {
$vowels .= "AEUY";
if ($strength >= 4) {
$consonants .= '23456789';
if ($strength >= 8 ) {
$vowels .= '@#$%';

$password = '';
$alt = time() % 2;
for ($i = 0; $i < $length; $i++) { if ($alt == 1) { $password .= $consonants[(rand() % strlen($consonants))]; $alt = 0; } else { $password .= $vowels[(rand() % strlen($vowels))]; $alt = 1; } } return $password; }

Tags: Password Generator PHP Snippet

About Misue Khan

Password Generator PHP Snippet Its Masum Billah


Discuss about: Password Generator PHP Snippet