FabioRicali.it

Generare una password facile da ricordare con php

by info@fabioricali.it on mag.09, 2010, under PHP

Questa funzione permette di generare una password facile da ricordare a mente tipo fomudi_819

function easy_password($n=3){
	$arr_consonant = array("b","c","d","f","g","l","m","n","v","z","k","w","x");
	$arr_vowel = array("a","e","i","o","u","y");
	$arr_number = range(0,9);
	shuffle($arr_consonant);
	shuffle($arr_vowel);
	shuffle($arr_number);
	$word = "";
	$number = "";
	for ($i=0; $i<$n; $i++){
		$word .= $arr_consonant[$i].$arr_vowel[$i];
		$number .= $arr_number[$i];
	}
	return $word."_".$number;
}
echo easy_password()

Il paramentro opzionale da passare setta il numero di coppie “consonante-vocale”, di default รจ impostato a 3.

:

Leave a Reply

Looking for something?

Use the form below to search the site:

Still not finding what you're looking for? Drop a comment on a post or contact us so we can take care of it!

Visit our friends!

A few highly recommended friends...

Archives

All entries, chronologically...