|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
#1
|
|||
|
|||
|
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!
|
|
#2
|
||||
|
||||
|
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? |
|
#3
|
|||
|
|||
|
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! |
|
#4
|
|||
|
|||
|
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 .... ) |
|
#5
|
|||
|
|||
|
You can write a php script to use content-disposition headers and it will prompt users to download instead of telling the path.
|
|
#6
|
||||
|
||||
|
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 =) |
|
#7
|
|||
|
|||
|
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!
|
|
#8
|
|||
|
|||
|
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 ![]() |
|
#9
|
|||
|
|||
|
Here is an example for outputting a zip file ( for madcowdzz )
PHP Code:
Also you will have to use ob_start() and ob_end_flush() ... |
|
#10
|
||||
|
||||
|
Mike_r, thank you very much...
i' plan on looking into this further... its an interesting feature I didn't realize PHP could do |
![]() |
| Viewing: Dev Articles Community Forums > Programming > General Programming Help > How to Limiting Download? |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|