Solved

How do I control the number of downloads?

Posted on 2000-03-24
5
228 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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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

Highfive + Dolby Voice = No More Audio Complaints!

Poor audio quality is one of the top reasons people don’t use video conferencing. Get the crispest, clearest audio powered by Dolby Voice in every meeting. Highfive and Dolby Voice deliver the best video conferencing and audio experience for every meeting and every room.

Join & Write a Comment

My previous tech tip, Installing the Solaris OS From the Flash Archive On a Tape (http://www.experts-exchange.com/articles/OS/Unix/Solaris/Installing-the-Solaris-OS-From-the-Flash-Archive-on-a-Tape.html), discussed installing the Solaris Operating S…
I promised to write further about my project, and here I am.  First, I needed to setup the Primary Server.  You can read how in this article: Setup FreeBSD Server with full HDD encryption (http://www.experts-exchange.com/OS/Unix/BSD/FreeBSD/A_3660-S…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:
Learn how to navigate the file tree with the shell. Use pwd to print the current working directory: Use ls to list a directory's contents: Use cd to change to a new directory: Use wildcards instead of typing out long directory names: Use ../ to move…

772 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

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now