X-Git-Url: https://git.p6c8.net/jirafeau_mojo42.git/blobdiff_plain/41f33f9c1dac5381412bcab57c971fd08d1d8613..4823b32b6ce68f7a6a0949c225c808da4979506f:/lib/functions.php diff --git a/lib/functions.php b/lib/functions.php index cfb2703..ebfffd4 100644 --- a/lib/functions.php +++ b/lib/functions.php @@ -101,6 +101,21 @@ function jirafeau_gen_random($l) return $code; } +function jirafeau_gen_download_pass() +{ + $length = $cfg['download_password_gen_len']; + $allowed_chars = $cfg['download_password_gen_chars']; + if ($length <= 0) { + return false; + } + $pass=""; + for ($i = 0; $i < $length; $i++) { + $pass .= $allowed_chars[rand(0, strlen($allowed_chars) - 1)]; + } + + return $pass; +} + function is_ssl() { if (isset($_SERVER['HTTPS'])) {