This script was used to keep track of a users location, without using Cookies.
#!/usr/bin/perl
$home=$ENV{"HOME"};
require "$home/lib/cgi-lib.pl";
&ReadParse;
# Look at the inputted data, and make sure no ones put anything nasty
# in it. If it does, strip out the extra text.
foreach $key (sort keys %in)
{
$in{$key} =~ s/[+=#!;><&\*`\-|]|exec|Exec|EXEC|cmd|Cmd|CMD//g;
}
# Check to see if they belong here or not
if(!$in{"dirname"})
{
print "Location: http://golf.com/pchart/login.html", "\n\n";}
$dirname = $in{"dirname"};
# Check to see what got them here
if($in{"script"}
eq "pnh" || $in{"script"} =~ /New/)
{$file = "parnhole.html";}
else
{$file = "courseselect.html";}
# Generate the next page of data using the information provided
open(FORM, $file);
@file = <FORM>;
$trip = 0;
$count = 0;
$szfile = "" . @file;
print &PrintHeader;
while($count < $szfile)
{
if($file[$count] =~ /<\/BODY|<\/body/)
{&address;}
print $file[$count];
if ($file[$count] =~ /<FORM/ && $trip == 0)
{
print "<input type=\"hidden\" value=\"$dirname\" name=\"dirname\">\n";
$trip = 1;
}
if($file[$count] =~ /<BODY|<body/)
{&navad;}
$count++;
}
close (FORM);