Solved

How do I control the number of downloads?

Posted on 2000-03-24
5
234 Views
Last Modified: 2010-04-21
Tell me if this belongs in another category......

Here's what I want to do:

I want to offer some material through a webpage, as .htm files, probably zipped with a bunch of gifs and an index included.  A person would pay a fee, then recieve a password by email which would allow them one download that must be done by a certain date.

I know how to set up an ftp download from a webpage. How do I set it up to take passwords?  How do I allow only one download per password?  How do I make the password "expire"?

I have a shell account.

castello
0
Comment
Question by:castello
  • 3
5 Comments
 
LVL 2

Accepted Solution

by:
GP1628 earned 200 total points
ID: 2655541
how about using a .htpasswd file ?
It asks for a login and password before allowing the browser to show what is in that directory.

For each order make a subdirectory under your www directory, for your purposes it might be best to name the dir as the date and it must be used by plus an added number to handle more than one order that day.. That will make cleanup easy.

create an .htpasswd file in that directory. The login can be one selected by the user from the form, and the passwd can be a random one you generate.

So if Joe asks for your stuff you would send him an email telling him to go to

www.yoursite.com/~yourdirectory/000601-1
login as  joe
password is A1B2c3pickard

For cleanup you can have your shell automatically delete each days subdirectorys as
rm -r 000601*

Thats a bare bones layout. we can work out details if you like it
Gandalf  Parker
0
 

Author Comment

by:castello
ID: 2657413
I set up a simple version of this.  It works fine.  So I have "dated" directory containing the file to download and the password files.  So, I have to create another dated directory for each order, right? Or can that be automated somehow...   A couple of problems.  First, once I give the right username and password, I can download as many copies as I like as long as my browser is open.  How can I limit it to one download?  Also, what's to keep someone from going straight to my public_html directory via ftp client and getting my stuff for free?

I happened to post thisquestion twice, and someone suggested a CGI script, which seems more secure, but more work up front.  Since I don't even know if this "venture" will be successful, it makes sense to start with htpasswd if I can make it secure enough.
0
 

Author Comment

by:castello
ID: 2657472
I set up a simple version of this.  It works fine.  So I have "dated" directory containing the file to download and the password files.  So, I have to create another dated directory for each order, right? Or can that be automated somehow...   A couple of problems.  First, once I give the right username and password, I can download as many copies as I like as long as my browser is open.  How can I limit it to one download?  Also, what's to keep someone from going straight to my public_html directory via ftp client and getting my stuff for free?

I happened to post thisquestion twice, and someone suggested a CGI script, which seems more secure, but more work up front.  Since I don't even know if this "venture" will be successful, it makes sense to start with htpasswd if I can make it secure enough.
0
 
LVL 2

Expert Comment

by:mapc
ID: 2657848
To limit it to one download you need an access to the http server, or, at least to it's logs, so you can know when this even occured. If it is the case, then we can discuss it further.
0
 

Author Comment

by:castello
ID: 2667120
I do have access to the logs.  Here's an entry where I downloaded the file after giving the password:

492 ali-ca-cache1.icg.net - joe [25/Mar/2000:15:49:48 -0800] "GET /~me/mtfe/033000-1/dwnlod.zip HTTP/1.0
" 200 78 "http://www.isp.com/~me/mtfe/033000-1/pwdtest.htm" "Mozilla/4.7 [en] (Win98; U)" 0 www.isp.com

So how do I use this to limit joe to one download...

For now I will not concern myself with the fact that someone can get to dwnload.zip via my annoymous ftp space (no way arround this at my ISP).  I can watch the logs, and if it's a problem, I'll deal with it at that time.
0

Featured Post

Free Tool: Port Scanner

Check which ports are open to the outside world. Helps make sure that your firewall rules are working as intended.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Let's say you need to move the data of a file system from one partition to another. This generally involves dismounting the file system, backing it up to tapes, and restoring it to a new partition. You may also copy the file system from one place to…
A metadevice consists of one or more devices (slices). It can be expanded by adding slices. Then, it can be grown to fill a larger space while the file system is in use. However, not all UNIX file systems (UFS) can be expanded this way. The conca…
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.

679 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question