referer.cgi

 


#!/usr/bin/perl

@pairs = split(/&/, $ENV{'QUERY_STRING'});

foreach $pair (@pairs)
{
    ($key, $value) = split (/=/, $pair);
    $key =~ tr/+/ /;
    $key =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~ tr/+/ /;
    $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
    $value =~s/<!--(.|\n)*-->//g;

    if ($formdata{$key})
    {
        $formdata{$key} .= ", $value";
    }
    else
    {
        $formdata{$key} = $value;
    }
}



$origin = $ENV{'HTTP_REFERER'};
print "Content-type:text/html\n\n";

if ($origin =~ m#http://www.lawsonhelp.com/#) {
	print "The page that launched the script is on my server";
	print "<P>The name you entered was $formdata{'name'}";
	} else {
	print "You can't run this script from that location. Sorry.";
	}