function gera_senha($chars=6) { $s="a b c d e f g h i j k l m n o p q r s t u v w x y z"; $s.=" 1 2 3 4 5 6 7 8 9 0"; srand((float)microtime()*1000000); $apwd=explode(" ",$s); shuffle($apwd); $chr=$apwd[array_rand($apwd)]; for ($i=0;$i<$chars;$i++) { $pwd.=$chr; while (strstr($pwd,$chr)!==false) { shuffle($apwd); $chr=$apwd[array_rand($apwd)]; } } return $pwd; }