httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ro...@differentpla.net
Subject Re: [users@httpd] OT: Tracking clients as they leave site -- means and options
Date Wed, 08 Jan 2003 12:57:35 GMT
On Wed, Jan 08, 2003 at 12:12:58AM -0600, Gary Turner wrote:
> An alternative would be to pass the target (not in the HTML sense) as an
> argument to a common script.  Now the script would need to parse target,
> referer, date, etc., and save to a log/database.

I don't understand why it has to be so complicated.

Surely the script won't need to save the log information?  You'll
have:

 <a href="/cgi-bin/go.cgi?target=some_unique_hashed_id">go here</a>.

Which will appear in your standard log file as something like:

 "GET /cgi-bin/go.cgi?target=some_unique_hashed_id HTTP/1.0"

with referrer, date and everything.

Your script then just looks up the hashed_id in a database (or perhaps
the target is encoded directly, and can be parsed out directly), and
issues the Location: response.  It should work fine.

In fact, I just tried it.  Go to:

http://www.beerology.net/cgi-bin/go.rb?http://www.slashdot.org/

...and it'll redirect you to http://www.slashdot.org/  The script looks like this:

#!/usr/bin/env ruby

print "Location: " + ENV['QUERY_STRING'] + "\r\n"
print "\r\n"

Error handling is left as an exercise for the reader.  The log file looks like this:

193.119.19.130 - - [08/Jan/2003:12:54:44 +0000] "GET /cgi-bin/go.rb?http://www.slashdot.org/
HTTP/1.1" 302 323 "-" "Mozilla/4.0 (compatible; MSIE 6.0; Windows NT 5.1; .NET CLR 1.0.3705)"

I'll disable the script shortly, so it might not be there when you try it.

Cheers,
Roger.

---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message