You use a link management system.
You can find examples of these all around the web, but I know you can
get some at http://www.hotscripts.com They are also probably more
complex and flexible than what i describe below.
Basically what it does (you could even write it yourself) is this:
1. All links point to a redirect.php script with a URL like the
following.
-
eg.1.http://www.domain.com/redirect.php?URL=http://www.otherdomain.com/place.
htm
OR
- eg.2 http://www.domain.com/redirect.php?link=432
Depending on which way you choose, the link=432 will search a database
with link 432 and send the user to that appropriate page.
2. To redirect the user (for eg.1) all is needed is redirect.php to
contain the following code
- eg. <?php header ("Location: $URL"); ?>
- before this line is called however you need to insert the url
(and maybe date/time/referring page etc aswell) into the database.
3. When you want to display the data, all you need to do is filter the
results and sum up the totals as necessary.
If you store the code the following way it seems much more flexible.
3/12/02 5:36PM http://www.domain.com/
http://www.referringdomain.com/page.htm
3/12/02 8:44PM http://www.domain2.co.uk/place.htm
http://www.referringdomain.
com/page2.htm
3/13/02 7:26AM http://www.domain.com/
http://www.referringdomain.com/page.htm
Cause you only have to do one sql statement (a quick insert, rather than
a select and update, etc) and then you can collate all data on a
different page, and provide comprehensive results.
Another link system (like eg.2 up above) would involve the database a
lot more, by connecting to the database and selecting certain links,
then updating, etc. this is would be good if you were storing addresses
(like downloadable things, eg PDFs or scripts, etc) cause then it really
is a link MANAGEMENT system, and not just a link stat counter
Adam
--
PHP Database Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php