
June 16th, 2000, 02:49 PM
|
|
Guest
|
|
Posts: n/a
Time spent in forums:
Reputation Power:
|
|
|
##form.html##
<html>
<body>
<form method="POST" action="/cgi-bin/script.pl">
<input type="text" name="email"><br>
<input type="submit" value="submit">
</form>
</body>
</html>
##script.pl##
#!/usr/local/bin/perl
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($1))/eg;
$value =~ s/<!--(.|n)*-->//g;
$value =~ s/<([^>]|n)*>//g;
$FORM{$name} = $value;
}
print "Content-type: text/htmlnn";
if ($FORM{'email'} eq "") {
print "Blank field!n";
}
else {
print "$FORM{'email'}n";
}
exit;
|