diff options
| author | ilotterytea <iltsu@alright.party> | 2025-06-03 03:57:48 +0400 |
|---|---|---|
| committer | ilotterytea <iltsu@alright.party> | 2025-06-03 03:57:48 +0400 |
| commit | 05a716756dfd32f1d8401076e713356590ace1e2 (patch) | |
| tree | a4581f90faafda224443eb6868af8181a9b2bdf7 /public | |
| parent | 1bbbfdbcfc5238267c6a713e64bf1fe3d36d9eff (diff) | |
feat: 'I'm feeling lucky' button
Diffstat (limited to 'public')
| -rw-r--r-- | public/index.php | 11 |
1 files changed, 10 insertions, 1 deletions
diff --git a/public/index.php b/public/index.php index d6c759c..086bff4 100644 --- a/public/index.php +++ b/public/index.php @@ -1,6 +1,14 @@ <?php include_once $_SERVER['DOCUMENT_ROOT'] . '/../config.php'; include_once $_SERVER['DOCUMENT_ROOT'] . '/../lib/partials.php'; + +if (FILE_CATALOG_RANDOM && isset($_GET['random'])) { + $files = glob(FILE_UPLOAD_DIRECTORY . "/*.*"); + $file = $files[random_int(0, count($files) - 1)]; + $filename = basename($file); + header("Location: /{$filename}"); + exit(); +} ?> <html> @@ -80,7 +88,8 @@ include_once $_SERVER['DOCUMENT_ROOT'] . '/../lib/partials.php'; <ul class="row gap-8 font-small" style="list-style:none"> <li> <p class="font-small">Max file size: - <b><?= get_cfg_var(option: 'upload_max_filesize') ?></b></p> + <b><?= get_cfg_var(option: 'upload_max_filesize') ?></b> + </p> </li> <li><a href="/uploaders.php#supported-file-extensions" target="_blank">Supported file extensions</a></li> |
