Script PHP para gerar senha

  • Post author:
  • Post category:Sem categoria

Este script PHP têm como função gerar senhas aleatórias, o interessante que o usuário pode setar a quantidade de caracteres a senha deve ter.

<?
/*
Programmed by Christian Haensel, [email protected], LINK1http://www.chftp.comLINK1
Exclusively published on weberdev.com.
If you like my scripts, please let me know or link to me.

You may copy, redistirubte, change and alter my scripts as long as this information remains intact
*/

$length        =    12; // Must be a multiple of 2 !! So 14 will work, 15 won’t, 16 will, 17 won’t and so on

// Password generation
$conso=array(“b”,”c”,”d”,”f”,”g”,”h”,”j”,”k”,”l”,
“m”,”n”,”p”,”r”,”s”,”t”,”v”,”w”,”x”,”y”,”z”);
$vocal=array(“a”,”e”,”i”,”o”,”u”);
$password=””;
srand ((double)microtime()*1000000);
$max = $length/2;
for($i=1; $i<=$max; $i++)
{
$password.=$conso[rand(0,19)];
$password.=$vocal[rand(0,4)];
}
$newpass = $password;
// ENDE Password generation
echo $newpass.”<p>”;
?>