link-exchange.cgi -- A CGI program to manage a WWW link exchange.
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
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
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
This will send the client to a random URL from the
$urldb file. It will not send the client back to the current URL.
Not specifying a query string at all will make the program behave the same
as if it were called with ``?next''.
There are two files of direct interest to link-exchange.cgi.
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:
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
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.
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.
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 firstname.lastname@example.org. Thanks!
the soap box |