Dieser Codeschipsel hilft dabei, ein Zufalls-Passwort aus vorgegebenem String zu erzeugen.
function random_password($length, $characters='abcdefgh1234567890'){ if ($characters == ''){ return ''; } $chars_length = strlen($characters)-1; mt_srand((double)microtime()*1000000); $pwd = ''; while(strlen($pwd) < $length){ $rand_char = mt_rand(0, $chars_length); $pwd .= $characters[$rand_char]; } return $pwd; }