General Programming Help
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
User Name:
Password:
Remember me
 
Go Back   Dev Articles Community ForumsProgrammingGeneral Programming Help

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Display Modes
 
Unread Dev Articles Community Forums Sponsor:
  #1  
Old January 22nd, 2004, 04:15 PM
Mary Mary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 59 Mary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 17 sec
Reputation Power: 0
How to Limiting Download?

I really need your helps! I am currently working on a download section. This is how it goes: Every new registered member will have 2 downloads, images for instance. How can design the code that I can limit them from the 3 download? Thank you very much!

Reply With Quote
  #2  
Old January 22nd, 2004, 04:56 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
You could keep track of the number of downloads using a counter field in your database... (i assume you're using a database for user information?)

The download page can then, in turn, link not to downloads but to a temp page which updates the database then relocates to the downloaded file.

Perhaps my vision of a possible solution could get the ol' motors spinning?

Reply With Quote
  #3  
Old January 22nd, 2004, 06:24 PM
Mary Mary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 59 Mary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 17 sec
Reputation Power: 0
Thanks for your promptly respond!

I can keep track of download times permission, but how can prevent people who already downloaded, and out of permissions, and they memozise the path and then come back to download again.

Is it possible that you can show me the structure, based on that I can set out to design the codes.

Thanks again!

Reply With Quote
  #4  
Old January 22nd, 2004, 07:46 PM
aboyousif aboyousif is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Tanta, Egypt
Posts: 21 aboyousif User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 23 sec
Reputation Power: 0
Send a message via AIM to aboyousif Send a message via MSN to aboyousif Send a message via Yahoo to aboyousif
there is alot of solutions to do that ..

1- every download require to open a page and the user must set this open to download the file ... when he close it .. the download will be canceled ...

2- when the user download files update database to know that he download only 2 files and in the files he sent to the site a confirmation code that mean he completed the download .. unless this .. he cann't do more than 2 downloads .

3- use a specific download programe made by visual basic as example to only control the downloads from your site ..

i think it is the possible soultions .. or the php experts here has another solution made by php ... ( in this case ... i will love php more & more & more & more .... )

Reply With Quote
  #5  
Old January 22nd, 2004, 09:31 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
You can write a php script to use content-disposition headers and it will prompt users to download instead of telling the path.
__________________
ExoHelpDesk
ExoCrew Free Services

Reply With Quote
  #6  
Old January 22nd, 2004, 10:57 PM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Mike_r, can you explain content-disposition a bit? That's a term I haven't come across before...

Mary, some simple pseudo code I would use may follow:

For the download page (a page of links to files)... have all links like this: temp_page?id=2

Then the temp_page would be as follows:

Code:
User_Result = SELECT My_Downloads FROM user WHERE id=(something)

If User_downloads < 3 THEN
    File_Result = SELECT filename FROM downloadable_files WHERE id=get(id)
    UPDATE table SET user_downloads= My_Downloads+1
    Header("Location: filename")
Else
    Print "Sorry, you've downloaded too many files"
End If


Keep in mind this is rough work straight from the top of my head...

Also, my suggestion isn't 100% secure... but I do believe sending the ID number instead of filename is a little more secure... One minor flaw might be that this requires you keep a table of downloadable files... but perhaps this was already in your project...

hopefully it'll get you moving towards your goal a bit =)

Reply With Quote
  #7  
Old January 23rd, 2004, 10:46 AM
Mary Mary is offline
Registered User
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Mar 2003
Posts: 59 Mary User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 1 h 5 m 17 sec
Reputation Power: 0
Thank you very much for all of your suggestion. Greatly appreciative! I will start of doing it by MadCowDuzz example, but it is going to take a little while. If I come across some problems, I will ask your guys later. Thanks all!

Reply With Quote
  #8  
Old January 23rd, 2004, 08:33 PM
aboyousif aboyousif is offline
Junior Member
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Tanta, Egypt
Posts: 21 aboyousif User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 29 m 23 sec
Reputation Power: 0
Send a message via AIM to aboyousif Send a message via MSN to aboyousif Send a message via Yahoo to aboyousif
MadCowDzz .. sorry but your code only limit the files to 2 (forever) .. it means that the user will only download 2 files from the site ..

i think Mary need to limit the number of download images to be 2 at most .. but if one of them finished the user can download the third .. etc ..

in a simple way .. she need to only make 2 downloads from the site together (no more) to limit (and control ) the trafic from the site ..

may be i wrong

Reply With Quote
  #9  
Old January 23rd, 2004, 08:57 PM
Mike_r Mike_r is offline
ExoCrew
Dev Articles Newbie (0 - 499 posts)
 
Join Date: Dec 2003
Posts: 68 Mike_r User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 6
Here is an example for outputting a zip file ( for madcowdzz )

PHP Code:
 $fp fopen $file'r' );
$FILE fread $fpfilesize $file ));
fclose$fp );

header("Content-type: application/octet-stream");  
header("Content-disposition: attachment; filename={$file}");

echo 
$FILE


Also you will have to use ob_start() and ob_end_flush() ...

Reply With Quote
  #10  
Old January 24th, 2004, 07:41 AM
MadCowDzz's Avatar
MadCowDzz MadCowDzz is offline
I'm Internet Famous
Dev Articles Frequenter (2500 - 2999 posts)
 
Join Date: Jan 2003
Location: Toronto, Canada
Posts: 2,890 MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level)MadCowDzz User rank is Lance Corporal (50 - 100 Reputation Level) 
Time spent in forums: 1 Week 16 h 14 m 9 sec
Reputation Power: 8
Mike_r, thank you very much...
i' plan on looking into this further... its an interesting feature I didn't realize PHP could do

Reply With Quote
Reply

Viewing: Dev Articles Community ForumsProgrammingGeneral Programming Help > How to Limiting Download?


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT