Generatore di Password

Generatore di password sicure, seleziona tutte le opzioni per creare combinazioni più complesse.


[insert_php]
if (!empty($_POST)) {

$elements = array();
$pass = array();
$moreel = array();
if (!empty($_POST[‘includi_numeri’])) {$elements[] =”0123456789″;}
if (!empty($_POST[‘includi_letmin’])) {$elements[] = “abcdefghijklmnopqrstuwxyz”;}
if (!empty($_POST[‘includi_letmaiusc’])) {$elements[] =”ABCDEFGHIJKLMNOPQRSTUWXYZ”;}
if (!empty($_POST[‘includi_speciale’])) {$elements[] = “~!@#$%^&*()-_=+[]{};:,.<>/?”;}

$elemeach = $_POST[‘lung_passw’] / count($elements);
$elemeach = explode(“.”,$elemeach) ;

foreach ($elements as $selements) {
for ($i = 1; $i <= $elemeach[0]; $i++) { $elements0 = strlen($selements) - 1; $n = rand(0, $elements0); $pass[] = $selements[$n]; } } $pass = implode($pass); $pass = str_shuffle($pass); if (strlen($pass) < $_POST['lung_passw'] ) { $more = $_POST['lung_passw'] - strlen($pass); $pass = $pass . substr(str_shuffle($pass) , 0 , $more); } if(strlen($pass) == 0) { $elements = implode($elements); $pass = array(); $elements0 = strlen($elements ) - 1; //put the length -1 in cache for ($i = 1; $i <= $_POST['lung_passw']; $i++) { $n = rand(0, $elements0 ); $pass[] = $elements[$n]; } $pass = implode($pass); } echo '

‘.$pass.’

‘;
} else {
//echo ‘

‘;
echo ‘

‘;
}
[/insert_php]