Zubrag.com
May 21, 2012, 12:20:15 am *
Welcome, Guest. Please login or register.
Did you miss your activation email?

Login with username, password and session length
 
   Home   Help Search Login Register  
Pages: [1]
  Print  
Author Topic: modification to secure download, please help  (Read 7006 times)
toxit
Newbie
*
Posts: 6


« on: December 06, 2006, 08:07:20 pm »

how could i do that

1. i have the folder set to /path/to/folder/ but i have sub folders like:

/path/to/folder/1
/path/to/folder/2
etc
where my files are located

2. i want to name the filename different then what it is in the folder, example.

i have filename in there called:
testfile.mp3 but i want to called it when the user saves it as myfile.mp3

so i can get these settings from a DB.

Please help me out,
Anton

Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #1 on: December 07, 2006, 04:15:12 am »

Changed downloader to support custom file names (#2 from your list).

Sample call (browser will try to save with file name specified by fc parameter):
   download.php?f=phptutorial.zip&fc=php123tutorial.zip

But if you want to use script like this: download.php?f=12345
and you want this to send phptutorial.zip from your server, then download.php needs to be modified to match your needs. Custom database connection/filename retrieval code needs to be placed before the // Check if the file exists line. So it would look somewhat similar to (just example):

// connect to database and get real file name by provided id
$link = mysql_connect(MYSQL_HOST, MYSQL_USER, MYSQL_PASSWORD) or die("Could not connect to database");
mysql_select_db(MYSQL_DB_NAME, $link) or die("Could not select database");
$result = mysql_query("select RealFileName from FilesTable where FilesTable.Id = " . mysql_escape_string($fname));
$res = mysql_fetch_row($result);
$fname = $res[0]; // this is the file script will send to the browser instead of 12345 code
mysql_free_result($result);
mysql_close($link);

// Check if the file exists

Option #1 from your list is not supported yet. I'll post update here when this feature added (this should trigger automatic email to you).
Logged
verotik
Newbie
*
Posts: 1


« Reply #2 on: December 09, 2006, 06:24:31 pm »

how could i do that

1. i have the folder set to /path/to/folder/ but i have sub folders like:

/path/to/folder/1
/path/to/folder/2
etc
where my files are located


I am also very interested in this mod.  I'll anxiously wait.
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #3 on: December 10, 2006, 06:11:53 am »

Guys, please clarify one thing.

Lets say you run script like this:  download.php?f=paris-hilton.mp4

What if paris-hilton.mp4 exists in both subfolders (1 and 2)? What should script do? Give away the first one found?
/path/to/folder/1/paris-hilton.mp4
/path/to/folder/2/paris-hilton.mp4
Logged
toxit
Newbie
*
Posts: 6


« Reply #4 on: December 12, 2006, 09:04:41 am »

Guys, please clarify one thing.

Lets say you run script like this:  download.php?f=paris-hilton.mp4

What if paris-hilton.mp4 exists in both subfolders (1 and 2)? What should script do? Give away the first one found?
/path/to/folder/1/paris-hilton.mp4
/path/to/folder/2/paris-hilton.mp4

it would work like this

in the Database there is the userID of the user and the song name safed which would be the /path/to/folder/userID/songname(fromDb)

so the script doesnt have to search for it really since it is provided from the DB, hope that helps a little to explain.

Anton
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #5 on: December 12, 2006, 10:31:13 am »

Ok.

Lets say you have database:

/path/to/folder/userID1/songname.mp3
/path/to/folder/userID2/songname.mp3

How do you want to use download.php? Is it like shown below?

download.php?f=userID1/songname.mp3
Logged
toxit
Newbie
*
Posts: 6


« Reply #6 on: December 12, 2006, 05:18:44 pm »

Ok.

Lets say you have database:

/path/to/folder/userID1/songname.mp3
/path/to/folder/userID2/songname.mp3

How do you want to use download.php? Is it like shown below?

download.php?f=userID1/songname.mp3


ok there is the follwing.

i have 3 values in the DB

SONG_ID
SONG_NAME
USER_ID

Song is saved as following.

path/to/folder/USER_ID/SONG_ID_hi.mp3

and the download should look like the following

download.php?f=SONG_NAME.mp3

Thank you so much here, i will donate some money after we get this working.

Anton
Logged
toxit
Newbie
*
Posts: 6


« Reply #7 on: December 16, 2006, 08:07:15 pm »

hey there haven't heard anything in a while here, please let me know if there are some more news.
Logged
drod70
Newbie
*
Posts: 3


« Reply #8 on: December 17, 2006, 09:48:18 pm »

Guys, please clarify one thing.

Lets say you run script like this:  download.php?f=paris-hilton.mp4

What if paris-hilton.mp4 exists in both subfolders (1 and 2)? What should script do? Give away the first one found?
/path/to/folder/1/paris-hilton.mp4
/path/to/folder/2/paris-hilton.mp4

That's exactly what I would like it to do or maybe even just crash if there are duplicates.

Being able to categorize my files into sub folders under under the main download folder would be a lot better than having everything thrown into one big folder.
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #9 on: December 19, 2006, 07:16:08 am »

Sorry guys, had no time to implement changes... Will be done tomorrow (20th), and I'll post update here.
Logged
toxit
Newbie
*
Posts: 6


« Reply #10 on: December 19, 2006, 01:17:25 pm »

Sorry guys, had no time to implement changes... Will be done tomorrow (20th), and I'll post update here.

No Problem at all, no stress over the holidays...
Logged
zubrag
Administrator
Hero Member
*****
Posts: 753


WWW
« Reply #11 on: December 21, 2006, 07:18:34 am »

Requests partly covered. Now it searches for the file in subfolders too. Who is interested just download new version from downloader home page.

Anton, still working on your request to get info from the database. Do not want to make it custom solution since others might also want to take filenames from database. So I'm thinking on how to make it "same change fits everybody".
Logged
toxit
Newbie
*
Posts: 6


« Reply #12 on: December 21, 2006, 07:22:07 am »

thanks you so much, i think it a very good idea to keep it open and not custom since more people are able to use it.

Anton
Logged
Pages: [1]
  Print  
 
Jump to:  

Powered by SMF 1.1.11 | SMF © 2006-2009, Simple Machines LLC