#!/usr/bin/perl ############################################################## # # # Ultimate Affiliate # # ***********TEXT EDITION********** # # By Steve Miles # # http://www.groundbreak.com # # # # Copyright 1999-2000 # # # # Selling or distributing this software or # # modifications of this software without # # permission is expressly forbidden. Permission # # to modify the script for personal use is granted. # # In all cases this header and copyright # # must remain intact. All violators will be # # PROSECUTED to the full extent. # # # ############################################################## require "config.cgi"; ###################################################################### # No need to edit below here ###################################################################### use CGI qw (:standard); $q = new CGI; $id = $q->param(id); $page = $q->param(page); $referurl = $q->referer(); ###################################################################### # Process a Clickthru ###################################################################### if (defined $id) { $ip = $q->remote_host(); $time = time(); $getcookie = $q->cookie($cookiename); if ("$getcookie") { $setcookie = "NO";} open (FILE, ">>$datadir$id"); flock(FILE, 2); print FILE "$time|$id|$ip|$referurl\n"; flock(FILE, 8); close (FILE); open (FILE, ">>$datadir$masterlog"); flock(FILE, 2); print FILE "$ip|$id\n"; flock(FILE, 8); close (FILE); if ($setcookie ne "NO") { if ($page =~ /$page_domain/ig && $use_page eq 1) { $cookie = $q->cookie(-name=>$cookiename, -value=>$id, -expires=>$cookietime); print $q->redirect(-url=>$page, -cookie=>$cookie); exit; } else { $cookie = $q->cookie(-name=>$cookiename, -value=>$id, -expires=>$cookietime); print $q->redirect(-url=>$home, -cookie=>$cookie); exit; }} } if ($page =~ /$page_domain/ig && $use_page eq 1) { print $q->redirect(-url=>$page); exit; } else { print $q->redirect(-url=>$home); exit; }