#!/usr/bin/perl ########################################################################### # Link Rountine - link.cgi # # # # Copyright (c) 1999, PathFinder Software # # Normand J. Charette # # # # # # # # Pro-TRACK PRO Version 1.0 09/06/1999 # # # # # ########################################################################### require "protrack.lib"; &SetServer; @DAYS = ('Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'); @MONTHS = ('January', 'February', 'March', 'April', 'May', 'June', 'July', 'August', 'September', 'October', 'November', 'December'); $exp_days = $ExpDays * $dayinSeconds; $exps = time + $exp_days; ($sec, $min, $hour, $mday, $mon, $year, $wday, $yday, $isdst) = localtime($exps); $wday = substr($DAYS[$wday], 0, 3); $mday = sprintf("%02d", $mday); $mon = substr($MONTHS[$mon], 0, 3); $year = 1900 + $year; $sec = sprintf("%02d:%02d:%02d", $hour, $min, $sec); $exps = "$wday, $mday-$mon-$year $sec GMT"; $sponsor = $ENV{'HTTP_REFERER'}; $ResellerID = $ENV{QUERY_STRING}; ($ResellerID, $zurl) = split(/\&/, $ResellerID); $zurl = $data{"zurl"}; if ($ResellerID && &unpackReseller("$ResellerID")) { $fields[1]++; $fields[19] = time + 7776000; @URLS = split(/\|-\|/,$fields[25]); if ($sponsor) { foreach $Url (@URLS) { if ($Url eq $sponsor) { $url_found = 1; last; } } if (!$url_found) { if ($fields[25] eq 'No Activity Yet') { $fields[25] = $sponsor; } else { $fields[25] = "$fields[25]|-|$sponsor"; } } } $thru_page = $fields[24]; &writeFile; print "Content-type: text/html\n"; $cookline = "Set-Cookie: banner=$ResellerID; expires=$exps; path=/\n"; print $cookline; # open (DBG, ">>cookie.log"); # print DBG $cookline; # close DBG; if ($data{"zurl"} ne "") { print "Location: $zurl\n\n"; } else { print "Location: $thru_page\n\n"; } } exit; #if ($data{"zurl"} ne "") { # print "Location: $OverridePage\n\n"; # } #} #elsif{ # print "Location: $thru_page\n\n"; #} #else { ## &Error("This link is no longer active"); #} #exit;