#! /usr/bin/perl #change above line to to where your perl resides #This script takes the cookie for that customer and sends it to King-Cart so #it can return it when it executes the order.pl on your server. #Syntax: http://yourserver.com/cgi-bin/gocart?[storeid] #Where yourserver.com/cgi-bin/ is the directory on your server that has your #affiliate program. [storeID] is the id for your store on King Cart. if ($ENV{'QUERY_STRING'}) { $query = $ENV{'QUERY_STRING'}; } else { print "Content-type: text/html\n\nError, Store ID is missing from query
\n"; } use CGI::Cookie; #grab cookie my %cookies = fetch CGI::Cookie; foreach (values %cookies) { if ($_ =~ /AFFILIATE=([^;]+?);/gi) { $affiliate = ($1); } } if ($affiliate) { $location = "store=$query&affil=$affiliate"; } else { $location = "store=$query"; } print "Location: http://www.king-cart.com/cgi-bin/cart.cgi?$location\n\n";