I need help.  I inherited this script that adds people to a text file for
our mailing list.  It works in Explorer.  However, it does not work in
Netscape.  Valid email addresses are blocked and the subroutine dienice is
called in Netscape.  It is pretty short and simple.  I do not have time to
rewrite it right now.  Could anyone make any suggestions?

Thanks in advance,
Andrew

____________________________________

#!/usr/bin/perl
print "Content-type:text/html\n\n";

read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split (/&/, $buffer);
foreach $pair (@pairs) {
        ($name, $value) = split(/=/, $pair);
        $value =~ tr/+/ /;
        $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($l))/eg;
        $FORM{$name} = $value;
}

chdir '../../discounts/ia/';
$DESTINATION="http://www.website.com/eclub_thankyou.adp";;

$f_name=$FORM{'f_name'};
$l_name=$FORM{'l_name'};
$company=$FORM{'company'};
$email=$FORM{'email'};
$us_state=$FORM{'us_state'};
$birth_month=$FORM{'birth_month'};
$birth_year=$FORM{'birth_year'};
$country=$FORM{'country'};
$salary=$FORM{'salary'};
$home=$FORM{'home'};
$clothing=$FORM{'clothing'};
$jewelry=$FORM{'jewelry'};
$air=$FORM{'air'};
$food=$FORM{'food'};
$hotel=$FORM{'hotel'};
$entertainment=$FORM{'entertainment'};
$auto=$FORM{'auto'};
$household=$FORM{'household'};
$electronic=$FORM{'electronic'};
$vacation=$FORM{'vacation'};
$tm = time;
$now = localtime($tm);

if ($FORM{'email'} !~ /[\w\-]+\@[\w\-]+\.[\w\-]+/) {
dienice("Please enter a valid email address");
}

open(OUTF,">>eclub.xls");
flock(OUTF,2);
seek(OUTF,0,2);

print OUTF
"$f_name\t$l_name\t$company\t$email\t$us_state\t$birth_month\t$birth_year\t$
country\t$salary\t$home\t$clothing\t$jewelry\t$air\t$food\t$hotel\t$entertai
nment\t$auto\t$household\t$electronic\t$vacation\t$now\n";
close(OUTF);

print <<EndHTML;
<HEAD>
<meta http-equiv="Refresh" content="0; URL=$DESTINATION">
</HEAD>
EndHTML

sub dienice {
        my($msg) = @_;
        print "<h2>Error</h2>\n";
        print $msg;
        exit;
}

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to