Front page | perl.beginners |
Postings from January 2002
What's wrong with this?
From:
Eduardo Cancino
Date:
January 24, 2002 13:25
Subject:
What's wrong with this?
Message ID:
003401c1a4e2$eef56bb0$200110ac@eduardo
Hi everybody!
The next script runs looks pefectly in IE but in Netscape it shows the
source of the html...
#!c:/perl/bin/perl.exe
# recibe la forma.
read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'});
@pairs = split(/&/, $buffer);
# inicia variables.
$to = "info\@domain.mx";
$from = "info\@domain.mx";
$subject = "Comentarios Sitio Web";
# manda el mail.
open (MAIL,"|mail $to");
print MAIL <<"END_top";
"To: $to
Reply-To: $to:
Subject: $subject"
END_top
foreach $pair (@pairs)
{
($name, $value) = split(/=/, $pair);
$value =~ tr/+/ /;
$value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg;
$form{$name} = $value;
if ($form{$name} ne "" && $form{$name} ne "no" && $name ne 'enviar') {
print MAIL $name . " = ". $form{$name} . "\n";
}
}
close MAIL;
# imprime html.
print <<WEB_page;
Content-type: text/html
<!doctype html public "-//w3c//dtd html 3.2 final//en">
<html>
<head>
<title>Ciceana - Gracias</title>
</head>
<body bgcolor='ffffff'>
<center>
<h1><font class='covitur'>Domain</font></h1>
</center>
<br>
<center>
<font>Has sido registrado</font>
</center>
<br>
<center>
<font>Gracias!</font>
</center>
<br>
<center>
<font face='Verdana' fgcolor='00006' size='2'><a
href='../index.html'>regresar<a>
<enter>
</body>
</html>
WEB_page
exit;
Thanks, Lalo.