From d2ef06f2dcd215545563d080cdc89a7d39c76d1f Mon Sep 17 00:00:00 2001 From: "Eric Johansson (neku)" Date: Wed, 11 Feb 2015 03:43:43 +0100 Subject: [PATCH] Update core.php --- core.php | 3 +++ 1 file changed, 3 insertions(+) diff --git a/core.php b/core.php index 50eeeb6..6f380db 100644 --- a/core.php +++ b/core.php @@ -10,10 +10,13 @@ function save_file ($file, $name){ echo 'http://a.uguu.se/'.$file_name; } Function gen_name ($in){ + //Check so the file doesn't exist, and generate random prefix + while(file_exists('/home/neku/www/files'.$name.'_'.$in)){ $chars = 'abcdefghijklmnopqrstuvwxyz'; $name = ''; for ($i = 0; $i < 6; $i++) { $name .= $chars[mt_rand(0, 25)]; + } } return $name.'_'.$in; }