diff options
author | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-29 03:20:00 +0000 |
---|---|---|
committer | Karl 'vollmerk' Vollmer <vollmer@ampache.org> | 2007-07-29 03:20:00 +0000 |
commit | db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6 (patch) | |
tree | d017e40d77c0d580aa6091dceabec7fd919a83c2 /lib/general.lib.php | |
parent | 20c3dc0fd1993b36a8ff3467fbc8c4f30c59588d (diff) | |
download | ampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.tar.gz ampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.tar.bz2 ampache-db47bcb6c018fecae71b8b7120c70d7ef9c7bcf6.zip |
fixed play all artist, play all artist random, and account updating from user preferences
Diffstat (limited to 'lib/general.lib.php')
-rw-r--r-- | lib/general.lib.php | 35 |
1 files changed, 24 insertions, 11 deletions
diff --git a/lib/general.lib.php b/lib/general.lib.php index 56c75c28..65422c48 100644 --- a/lib/general.lib.php +++ b/lib/general.lib.php @@ -519,19 +519,32 @@ function get_file_extension( $filename ) { } } // get_file_extension -/** - * tbl_name - * This function takes a SQL table name and returns it with any prefix - * that might be needed to make it work, - * @package General - * @catagory Database +/** + * generate_password + * This generates a random password, of the specified + * length */ -function tbl_name($table) { - - /* For now we just return the table name */ - return $table; +function generate_password($length) { + + $vowels = 'aAeEuUyY12345'; + $consonants = 'bBdDgGhHjJmMnNpPqQrRsStTvVwWxXzZ6789'; + $password = ''; + + $alt = time() % 2; + + for ($i = 0; $i < $length; $i++) { + if ($alt == 1) { + $password .= $consonants[(rand() % 39)]; + $alt = 0; + } else { + $password .= $vowels[(rand() % 17)]; + $alt = 1; + } + } -} // tbl_name + return $password; + +} // generate_password /** * scrub_out |