Welcome to Islandnet.com  
Locally owned and operated since 1993  
Live Help
LOG IN:  Username:    Password:    

DownloadIt

Synopsis

This gadget allows you to provide one-time downloading of one or more files to a user. This is ideal for software developers who want to allow their clients to retrieve a file at their leisure, but don't want to provide access to it to everyone on the internet. Users must provide a valid user ID and password (assigned by you).


Setup

This whole gadget is based on the concept of a "key file". Each key file you create has a single user ID and password associated with it, and may grant access to as many as 20 different files of any type. Anyone who knows the user ID and password can download each file listed in the key file exactly once.

The first thing you need to do is create a "keys" subdirectory off your root. This is the directory in which all key files are expected to be found. Note that this is NOT in or below your "www" directory, as that would allow anyone to access them directly. You can create this directory from the shell prompt or via an FTP client.

A key file is simply an ASCII text file that is located in your "keys" directory. The name of the file must be "USERID.key", where "USERID" is the user ID you expect the customer to enter when retrieving files. There can be no spaces in the user ID.

The first thing that must appear within a key file is the password that is associated with the user ID. It must appear on a line like this:

Password: PASS
You would, of course, replace "PASS" with the actual password. The rest of the file consists of one to twenty sections that look like this:

Filename: FILE
Description: DESC
MimeType: MIME
Expires: YYYY-MM-DD HH:MM
Downloaded: YYYY-MM-DD HH:MM
Host: HOST
Replace "FILE" with the name of the file. This is relative to your root directory. You may want to place the files in a subdirectory to keep them out of your root. For example, if you want a user to download the file "example.zip" and it is located in the "download" directory, you would replace FILE with "download/example.zip". Do not place these files anywhere within the "www" directory or else a user will be able to bypass this mechanism.

Replace "DESC" with a brief text description of the file. This is the text that the user will click on. It could just be the file name, or it can be a short sentence. Do not make this lengthy or it will not look all that great.

The MimeType line is optional. The gadget will try and guess the appropriate mime type based on the file name extension. If you provide a mime type it overrides the extension. For example, if a file is named "example.zip" and you do NOT set this option, the gadget will correctly guess "application/zip" as the mime type.

The Downloaded line is not set by you and should be left out. It will be added by the gadget when a user downloads the file. If this line is present, then the file is no longer available for download by this particular user ID.

The Host line is also not set by you. The gadget will insert this line to indicate the host name or IP address of the machine that downloaded the file.

Upon a successful download of one of the files, the Downloaded and Host lines are inserted into the key file and an email message is sent to you to indicate the transaction. Aborted downloads are considered incomplete and do not alter the key file or send you email.

For a user to access one of these files, you need to set up a login page. The form should look like this:

<form method=post action=/cgi-bin/downloadit>
<input type=hidden name=login value=guest>
<input type=hidden name=error value=ERROR>
<input type=hidden name=header value=HEADER>
<input type=hidden name=footer value=FOOTER>
Enter your User ID: <input name=userid>
Enter your Password: <input type=password name=password>
<input type=submit value=" Proceed ">
</form>
ERROR is the name of an html file that will be used to display error messages (invalid user ID, expired file, etc). This is relative to your "www" directory. This file is treated as a Template File. The string {ERRORMSG} anywhere in this file will be replaced with the actual error message.

HEADER and FOOTER are the names of html files, relative to your "www" directory. If the user provides a valid user ID and password, then they will be presented with a list of files that they are allowed to download. The header is inserted above this list, the footer below.

When a user is presented with a list of files, only those that have not expired and have not already been downloaded are clickable.



Page generation time: 0.02 seconds