if (file_exists($ds)) { echo "<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n"; $ds = array($dest, $slash, rand(0,9999), $newfilename); $ds = implode("", $ds); }
echo "<p>New destination $ds</p>\n"; if (!copy($file, $ds)) { echo "<p>Was unable to copy $file <br>\n See if your path and destination are correct.</p> \n"; } else { echo "<p><strong>Copy successful!</strong></p> \n"; }}} ?>
you might have understand it. :-) Now, i want to input above fields below attachment filed. Only certain groups are allowed to use this function. Can you rewrite it as a mod, giving full permissions to do it. ;-)
Global Moderator Community Supporter?
Jedai Sword Master
Gender:
Posts: 6274
38470 credits Members referred : 374
if (file_exists($ds)) { echo "<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n"; $ds = array($dest, $slash, rand(0,9999), $newfilename); $ds = implode("", $ds); }
with this :
if (file_exists($ds)) { echo "<p>File already exists! <br>\n Adding random digits to beginning of filename.</p>\n"; do { $ds = implode('',array($dest, $slash, rand(0,9999), $newfilename));//Actually this can be done faster but I am a little bored right now } while ( file_exists($ds) )
BTW the script as is, is unsecure, as the user can actually rewrite files of your server, as you don't have any restriction on the directory that he/she is uploading to.
My name is Bong, James Bong
Posts: 11
80 credits Members referred : 0
« Reply #4 on: Nov 29, 2006, 03:53:38 PM »
Like yr idea! Hope it's a matter of 10min? Yeah, it's a file hosting n forum. Can you please do it brother as a mod. I will be happy with it!
My name is Bong, James Bong
Posts: 11
80 credits Members referred : 0
« Reply #5 on: Nov 29, 2006, 03:55:16 PM »
Like yr idea! Hope it's a matter of 10min? Yeah, it's a file hosting n forum. Can you please do it brother as a mod. I will be happy with it!
Didn't get, how user can rewrite files. Because did you see code for random digit. When you upload same file, it adds random digit. So i didn't find, how it rewrites?
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7944
40613 credits Members referred : 3
« Reply #6 on: Nov 29, 2006, 03:58:04 PM »
Quote
Didn't get, how user can rewrite files. Because did you see code for random digit. When you upload same file, it adds random digit. So i didn't find, how it rewrites?
The user can add a new filename in the script, in which he/she can actually use a full path in the system......
My name is Bong, James Bong
Posts: 11
80 credits Members referred : 0
« Reply #9 on: Nov 29, 2006, 04:33:20 PM »
Yeah brothr, i tried it...But didn't able to do it. Hope you will spend ten minutes to complete it. I am confused, how does it take more than 10 minutes. The main problem is, option should be available for only few allowed groups :'-(
I am a metal monkey!
Administrator Community Supporter?
Jedai Sword Master
Gender:
Posts: 7944
40613 credits Members referred : 3
« Reply #10 on: Nov 29, 2006, 04:40:07 PM »
If it was 10 minutes, I would allready had it done, and as I said before I am very busy these days.....