NAME

link-exchange.cgi -- A CGI program to manage a WWW link exchange.


DESCRIPTION

link-exchange.cgi provide a link exchange service, whereby everyone part of a ``link exchange'' or ``web ring'' can put a link on their page to the URL where this program is running. This program will then return an HTTP redirect to another page on the webring. The URL to this program can be any of the following:

http://your-server/path-to-program/link-exchange.cgi?next
This will send the client to the next URL on the list, in the order of the $urldb file. If the current URL is last on the list, the client will be sent to the first.

http://your-server/path-to-program/link-exchange.cgi?prev
This will send the client to the previous URL on the list, in the order of the $urldb file. If the current URL is the first, the client will be directed to the last.

http://your-server/path-to-program/link-exchange.cgi?rand
This will send the client to a random URL from the $urldb file. It will not send the client back to the current URL.

http://your-server/path-to-program/link-exchange.cgi
Not specifying a query string at all will make the program behave the same as if it were called with ``?next''.


FILES

There are two files of direct interest to link-exchange.cgi.

$urldb
This is a database of URLs in the link exchange. This is simply a newline-delimited flat file. It should be trivial to maintain this file.

By default, it is called link-exchange.urls, though you may specify any file you like by editing the source. The file will look something like this:

 http://first/url/
 http://second.url/
 http://third.url/~etc/

$urllog
This is a logfile kept by link-exchange.cgi that reports each time the program is called, the URL that links to it, the URL to which it sends the requesting client, and the ID of the client (browser type).

It is in the following format:

 [timestamp] remote_host referer "client identification"

By default its name is link-exchange.log but that can be changed by editing the source.


BUGS

The ``random URL'' could be a little more intelligent by trying to keep track of which clients have been sent to various sites. This could allow link-exchange.cgi to ensure that a client sees all of the sites in a link exchange before handing out repeats. Perhaps that feature will exist in a future version.

This could probably be rewritten to be more pretty, using functions, having a nice little main block to control things, and all that. But then, maybe that would have been overkill for such a little program.

Maybe not.


AUTHOR

 Copyright  1997 Matt Curtin

Do whatever you want with this program, except one thing: you may not repackage it and call it your own. My original authorship and copyright notice must remain intact with any version or derivative work. Is that asking too much?

If you do hack it to do something more useful, please throw me mail at cmcurtin@interhack.net. Thanks!


interhack | cmcurtin | vitals | the soap box | publications | perl | hackcam | links