#!/usr/bin/perl ################################################################# # Filename: go.cgi # # Link Track Pro v1.1 # # http://www.linktrackpro.com # # Developed by Cyber Share Enterprises # # http://www.cybershare.com # # # # Copyright (C) 1997-2000 - Cyber Share Enterprises # # All Rights Reserved. # # # ################################################################# # COPYRIGHT NOTICE: # # # # All files associated with Link Track Pro fall under # # this copyright notice. # # # # This program is not being distributed as freeware or # # shareware. Selling the code (in whole or in part) for this # # program without prior written consent is expressly # # forbidden. Obtain permission before redistributing this # # program over the Internet or in any other medium. # # # # Modification to the code is permitted so long as the # # modified code is not sold or redistributed without prior # # written consent. In all cases copyright and header must # # remain intact. # # # # All violators will be PROSECUTED to the full extent. # # # # This program is distributed "as is" and without warranty # # of any kind, either express or implied. In no event shall # # the liability of Cyber Share Enterprises for any damages, # # losses and/or causes of action exceed the total amount paid # # by the user for this software. # # # ################################################################# # # use CGI::Carp qw(fatalsToBrowser carpout); require 'config.cgi'; # This is the file where all the configuration lives. # The custom url to send people to if they access a link that isn't found. %oops = ('custom_name' =>$custom_name, 'custom_description' => $custom_desc, 'custom_url' => qq!$custom_url! ); %config = ('return' => $return, 'promote' => $promote, 'header' => $html_header, 'footer' => $html_footer, 'script_name' => $script_name, 'color1' => $color1, 'color2' => $color2, 'color3' => $color3, 'color4' => $color4 ); $query = $ENV{QUERY_STRING}; open (F, "$url_file") or die ("Can't open $url_file: $!"); while () { ($name, $description, $url) = split /\|/; if ($name eq $query) { $name.=".dat"; open (LOG, ">>$log_path$name"); $time=localtime(); print LOG "$time\t$ENV{'HTTP_REFERER'}\t$ENV{'REMOTE_ADDR'}\t$ENV{'HTTP_USER_AGENT'}\n"; close LOG; print "Location: $url\n\r\n\r"; exit(); } } # If no match... print "Content-type: text/html\n\r\n\r"; print &template('oops.html', %oops); exit(); sub template { # This does the dirty work of replacing the %%...%% # fields of a template with the appropriate values my @output; my %input; my $filename; ($filename, %input)=@_; # Tack on the data from the config file %vars = (%input, %config); open (F, "$file_path$filename") or die ("Couldn't open $filename: $!"); while () { s/%%([^\%]+)%%/defined($vars{$1}) ? $vars{$1} : ""/gsex; push @output, $_; } return @output; }