#!/usr/bin/perl ####################################################### # Absolute Redirect Clickthrough Tracker version 1.0 # # Created by: Design Werks # Email: delay@pobox.com # Web: http://scripts.vrmatrix.com # ####################################################### # # # COPYRIGHT NOTICE: # # Copyright 2000 Design Werks All Rights Reserved. # # This program is being distributed as ad-ware. It may be used # free of charge, so long as this copyright notice and # the program remain intact. Please also send me an email, # and let me know where you are using this script. # # By using this program you agree to indemnify Design Werks from any liability. # # Selling the code for this program without prior written consent is # expressly forbidden. Obtain permission before redistributing this # program over the Internet or in any other medium. In all cases # copyright and header must remain intact. # # Warranty Disclaimer # -------------------- # THIS SOFTWARE AND THE ACCOMPANYING FILES ARE AVAILABLE "AS IS" AND # WITHOUT WARRANTIES AS TO PERFORMANCE OR MERCHANTABILITY OR ANY # OTHER WARRANTIES WHETHER EXPRESSED OR IMPLIED. # # The user assumes the entire risk of using the program. # We do not warrant that it works on all servers and will not be held liable # for anything, including but not limited to, misusage, error, or loss of data. # # Use at your own risk! ###################################################### #DO NOT edit below this line...... #Sorry to all the perl coders out there who wanted to go through the code. #The ads would have been very easy to remove if I didn't scramble it. 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; } $LogFileName = $OldLogFileName; $MainUrl = $RequestArray{'go'}; $SelectedAction = $RequestArray{'page'}; $ActualUrl = $RequestArray{'url'}; $LoginPassword = $RequestArray{'password'}; $SelectedDate = $RequestArray{'dateselect'}; $RequestRef = $ENV{'HTTP_REFERER'}; $CurrentDate = `date +"%D"`; chop($CurrentDate); $CountOneVar = 1; sub aab { $RandomNum = int ( rand(999999)); print qq|
\n

|; } print qq|Content-type: text/html\n\n\n\tHistory\n\t\n\t
\n\t|; if ($AdminPassword eq $LoginPassword) { print qq|
[ MAIN ] - \n\t\t[ RETURN TO CURRENT STATS ] -\n\t\t[ HELP ]

|; &aab; } else { } if (($SelectedAction eq "main") && ($AdminPassword eq $LoginPassword)) { open(DATA,"$LogFileName"); @LoadedLogArray = ; close(DATA); %HitArray =(); %DateItemsCount =(); foreach $LogKey (@LoadedLogArray) { ($DateFromLog, $RefFromLog, $UrlToAnalyze, $HitsToDate) = split(/ \| /,$LogKey); $DateItemsCount{$DateFromLog}++; if ($DateFromLog eq $SelectedDate){ if (exists($HitArray{$UrlToAnalyze})){ $I11I11I1I11I11II = $HitsToDate + $HitArray{$UrlToAnalyze}; $HitArray{$UrlToAnalyze} = $I11I11I1I11I11II; } else { $HitArray{$UrlToAnalyze} = $HitsToDate; }} } print qq|
\n\n\t\t\n\n\t\t\n\t\t\n\n\t\t\n\n\t\t
|; while (($UrlToAnalyze, $HitsToDate) = each (%HitArray)){ print qq|\n\t\t\t|; $HitsTotalNum = ($HitsTotalNum + $HitsToDate); } print qq|
$SelectedDate
URLHits
$UrlToAnalyze$HitsToDate
Total clickthroughs:$HitsTotalNum
|; } elsif (($SelectedAction eq "pagestats") && ($AdminPassword eq $LoginPassword)) { open(DATA,"$LogFileName"); @LoadedLogArray = ; close(DATA); print qq|
|; foreach $LogKey (@LoadedLogArray) { ($DateFromLog, $RefFromLog, $UrlToAnalyze, $HitsToDate) = split(/ \| /,$LogKey); if ($DateFromLog eq $SelectedDate){ if ($RefFromLog eq $ActualUrl) { print qq|\n\t\t\t\t|; $HitsTotalNum = ($HitsTotalNum + $HitsToDate); } } } print qq|
$SelectedDate
Clicks from:
$ActualUrl
Hits
$UrlToAnalyze$HitsToDate
Total clickthroughs:$HitsTotalNum
|; } elsif (($SelectedAction eq "examref") && ($AdminPassword eq $LoginPassword)) { open(DATA,"$LogFileName"); @LoadedLogArray = ; close(DATA); print qq|
|; foreach $LogKey (@LoadedLogArray) { ($DateFromLog, $RefFromLog, $UrlToAnalyze, $HitsToDate) = split(/ \| /,$LogKey); if ($DateFromLog eq $SelectedDate){ if ($UrlToAnalyze eq $ActualUrl) { print qq|\n\t\t\t\t|; $HitsTotalNum = ($HitsTotalNum + $HitsToDate); } } } print qq|
$SelectedDate
Referering URLS for:
$ActualUrl
Hits
$RefFromLog$HitsToDate
Total clickthroughs:$HitsTotalNum
|; } elsif (($SelectedAction eq "history") && ($AdminPassword eq $LoginPassword)) { open(DATA,"$LogFileName"); @LoadedLogArray = ; close(DATA); open(DATAOLD,">>$OldLogFileName"); foreach $LogKey (@LoadedLogArray){ print DATAOLD $LogKey; } close(DATAOLD); open(DATA,">$LogFileName"); print DATA ""; close(DATA); print "Current Log file was moved to History

\n"; } elsif (($SelectedAction eq "help") && ($AdminPassword eq $LoginPassword)) { ($DomainPartSplitOff, $QueryStringSplitOff) = split(/\.cgi/,$RequestRef); print qq|\n\t\tHELP:

\nMore help available at scripts.vrmatrix.com

\n\nFunctions of the menu at top of screen:\n
\n[ MAIN ] - [ MOVE CURRENT LOG TO HISTORY ] - [ VIEW HISTORY ] - [ HELP ] \n
\n


\nMAIN:
\n\nThis will take you to the main default area of the script. This is where you can view basic clickthroughs and change the date that you want to view click throughs for.\n

\nMOVE CURRENT LOG TO HISTORY:
\n\nThis will move all current data in the script to the history script. \nYou will want to do this occasionally if you are tracking a large number of links. \nThis helps keep the redirection part of the script operating efficiently. \nAlso you will probably not want to scroll through a huge amount of dates \nso you can move it to the history where you can still review the stats \nif you need to but aren't bothered by all the extra dates in the \nchange date selector.\n

\nVIEW HISTORY:
\n\nThis switches over to the history script which allows you to view any old \ndata if you have used the operation above.\n

\nHELP:
\n\nThis file.\n

\n


\n

\nClicking urls:
\nAlso you will notice that you can click on the url links on the main page. \nWhen you do this it will pull up any referer pages or domains for that link.\nOnce again the referer info is linked. If you click on any of the referer links it\nwill pull up all links that the referer page has sent. \n

\n


\n\nHow to record clicks with the script:\n

\n\t\tSelect Menu

\n\t\t<FORM METHOD="get" ACTION="http://www.yoursite.com/cgi-bin/redirect.cgi">
\n\t\t<SELECT NAME=link>
\n\t\t   <OPTION VALUE="http://www.zippety.com">Zippety
\n\t\t   <OPTION VALUE="http://www.metacrawler.com">Metacrawler
\n\t\t</SELECT>
\n\t\t<INPUT TYPE=submit VALUE="submit">
\n\t\t</FORM>

\n\t\tHTML Link

\n\t\t<A HREF="http://www.yoursite.com/cgi-bin/redirect.cgi?link=http://www.zippety.com">Zippety</A>

|; } else { &aab; print qq|

\n\t\t\n\t\t\n\n\t\tPassword:\n\t\t\n\t\t\n\t\t
|; } print qq|


|; exit;