X-Git-Url: https://git.p6c8.net/jirafeau.git/blobdiff_plain/41f33f9c1dac5381412bcab57c971fd08d1d8613..d4e344cf24f5cc5c8c8c563b756cc42530c38fcd:/lib/functions.php?ds=inline 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'])) {