]> jfr.im git - uguu.git/commitdiff
Update core.php
authorEric Johansson (neku) <redacted>
Wed, 11 Feb 2015 02:43:43 +0000 (03:43 +0100)
committerEric Johansson (neku) <redacted>
Wed, 11 Feb 2015 02:43:43 +0000 (03:43 +0100)
core.php

index 50eeeb6437be2723992eff9dedb92c2e4168c1aa..6f380dbf65d349d7a004515f2cdf874a98134f55 100644 (file)
--- 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;
 }