#!/usr/bin/perl ####################################################### # Absolute Redirect Clickthrough Tracker version 1.0 # # Created by: Design Werks # Email: delay@pobox.com # Web: http://scripts.vrmatrix.com # Please see other scripts distributed with this script for copyright and other info. # It was not included here to make this script as small as possible so it will execute quickly. ####################################################### require "config.pl"; $QueryString=$ENV{'QUERY_STRING'}; @QueryStringArray=split(/\\/,$QueryString); foreach $I1I11I11III111II(@QueryStringArray) { ($I1I1111II1I1III1,$I1111111I1III1II)=split (/=/,$I1I11I11III111II,2); $I1111111I1III1II=~tr/+/ /; $I1111111I1III1II=~ s/%(..)/pack("c",hex($1))/ge; $RequestArray{$I1I1111II1I1III1}=$I1111111I1III1II; } $MainUrl = $RequestArray{'go'}; $RequestRef = $ENV{'HTTP_REFERER'}; $CurrentDate = `date +"%D"`; chop($CurrentDate); $CountOneVar = 1; $MainUrlTemp = $MainUrl; $MainUrlTemp =~ s/\&/&/g; if ($ShortDomainReferer eq 1) { $DomainRequestRef = $ENV{'HTTP_REFERER'}; $DomainRequestRef =~ /\/\/(.*?)\//; $RequestRef = $1; } if ($RequestRef eq "") { $RequestRef = "no referer info supplied"; } if ($MainUrl) { open(DATA,"$LogFileName"); @LoadedLogArray = ; close(DATA); open(DATA,">$LogFileName"); foreach $LogKey (@LoadedLogArray) { ($DateFromLog, $RefFromLog, $UrlToAnalyze, $HitsToDate) = split(/ \| /,$LogKey); $UrlToDisplay = $UrlToAnalyze; $UrlToDisplay =~ s/\&/&/g; if (($DateFromLog eq $CurrentDate) && ($RequestRef eq $RefFromLog) && ($MainUrlTemp eq $UrlToDisplay)) { $HitsToDate++; print DATA "$DateFromLog \| $RefFromLog \| $UrlToDisplay \| $HitsToDate\n"; $CountOneVar = 0; } else { print DATA $LogKey; } $HitsTotalNum = ($HitsTotalNum + $HitsToDate); } close(DATA); if ($CountOneVar eq 1) { open (DATA,">>$LogFileName"); print DATA "$CurrentDate \| $RequestRef \| $MainUrlTemp \| 1\n"; close(DATA); $HitsTotalNum++; } print "Content-type: text/html\n"; print ("Location: $MainUrl\n\n"); } else { print "Content-type: text/html\n"; print ("Location: http://www.vrmatrix.com/redirect/redirect.html\n\n"); } exit;