referer.cgi

 


#!/usr/bin/perl

if ($ENV{'REQUEST_METHOD'} eq 'GET')
{
        @pairs = split(/&/, $ENV{'QUERY_STRING'});
}
elsif ($ENV{'REQUEST_METHOD'} eq 'POST')
{
    read (STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    @pairs = split(/&/, $buffer);

    if ($ENV{'QUERY_STRING'})
    {
        @getpairs =split(/&/, $ENV{'QUERY_STRING'});
        push(@pairs,@getpairs);
    }
}
else
{
    print "Content-type: text/html\n\n";
    print "<P>Use Post or Get";
}


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

if ($origin =~ m#http://www.setgetweb.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.";
	}