Update core.php

This commit is contained in:
Eric Johansson (neku) 2015-02-11 17:36:03 +01:00
parent 64c27042fc
commit b21789cd17
1 changed files with 6 additions and 6 deletions

View File

@ -4,11 +4,11 @@ function save_file ($file, $name, $arg){
$path='/home/neku/www/files/'; $path='/home/neku/www/files/';
//Generate name depending on arg //Generate name depending on arg
switch($arg){ switch($arg){
case 'rand': case 'random':
$ext = pathinfo($file, PATHINFO_EXTENSION); $ext = pathinfo($file.$name, PATHINFO_EXTENSION);
$file_name gen_name('random', $ext); $file_name = gen_name('random', $ext);
while(file_exists($path.file_name)){ while(file_exists($path.$file_name)){
$file_name gen_name('random', $ext); $file_name = gen_name('random', $ext);
} }
break; break;
case 'custom_original': case 'custom_original':
@ -24,7 +24,7 @@ function save_file ($file, $name, $arg){
//Return url+filename to the user //Return url+filename to the user
echo 'http://a.uguu.se/'.$file_name; echo 'http://a.uguu.se/'.$file_name;
} }
function gen_name($arg, $in, $in2){ function gen_name($arg, $in){
$chars = 'abcdefghijklmnopqrstuvwxyz'; $chars = 'abcdefghijklmnopqrstuvwxyz';
$name = ''; $name = '';
for ($i = 0; $i < 6; $i++) { for ($i = 0; $i < 6; $i++) {