summaryrefslogtreecommitdiff
path: root/php
diff options
context:
space:
mode:
Diffstat (limited to 'php')
-rw-r--r--php/includes/settings.inc.php8
-rw-r--r--php/upload.php4
2 files changed, 10 insertions, 2 deletions
diff --git a/php/includes/settings.inc.php b/php/includes/settings.inc.php
index 0695981..19a3987 100644
--- a/php/includes/settings.inc.php
+++ b/php/includes/settings.inc.php
@@ -82,6 +82,14 @@ define('POMF_FILES_LENGTH', 6);
define('POMF_URL', 'https://i.pantsu.cat/');
/**
+ * URI for filename generation
+ *
+ * @param string characters to be used in generateName()
+ */
+define('ID_CHARSET', 'abcdefghijklmnopqrstuvwxyz');
+
+
+/**
* Blocked mime types
* @param string[] $FILTER_MIME blocked mime types
*/
diff --git a/php/upload.php b/php/upload.php
index 6ee85ad..9b58ba4 100644
--- a/php/upload.php
+++ b/php/upload.php
@@ -42,10 +42,10 @@ function generateName($file)
500); // HTTP status code "500 Internal Server Error"
}
- $chars = range('a', 'z');
+ $chars = ID_CHARSET;
$name = '';
for ($i = 0; $i < $length; ++$i) {
- $name .= $chars[array_rand($chars)];
+ $name .= $chars[mt_rand(0, strlen($chars))];
}
// Add the extension to the file name