#!/usr/bin/perl
#
# ---------------------------------------------------------------------------
#                               CONSTANTS
# ---------------------------------------------------------------------------
########

sub read_input
{
    local ($buffer, @pairs, $pair, $name, $value, %FORM);
    # Read in text
    $ENV{'REQUEST_METHOD'} =~ tr/a-z/A-Z/;
    if ($ENV{'REQUEST_METHOD'} eq "POST")
    {
	read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
    } else
    {
	$buffer = $ENV{'QUERY_STRING'};
    }
    # Split information into name/value pairs
    @pairs = split(/&/, $buffer);
    foreach $pair (@pairs)
    {
	($name, $value) = split(/=/, $pair);
	$value =~ tr/+/ /;
	$value =~ s/%(..)/pack("C", hex($1))/eg;
	$FORM{$name} = $value;
    }
    %FORM;
}

#*********************
#%incoming = &read_input; # Read information into associated # array %incoming.
#$referrer = $incoming{'Referrer'};
#$productid = $incoming{'ProductID'};
#$urlp = $incoming{'urlp'};
#*********************
#######
# ---- Make sure a valid search was selected -----
#if ($referrer eq "")
#{
#  $referrer = "11765";
#}
#
#if ($productid eq "")
#{
#  $productid = "0";
#}
#if ($urlp eq "")
#{
#   $urlp = "https://www.e-scripts-md.com/escripts/neworder.asp?ProductID=$productid&Referrer=$referrer";
#}
#
#*****************************************************************************

#print "Location: $urlp\n\n";

print "Location: http://www.ehealthstore.net/prescription-pharmacy-online/index.php?page=search\n\n";
