Ver Mensaje Individual
  #1 (permalink)  
Antiguo 14/06/2004, 22:48
Avatar de rocl
rocl
 
Fecha de Ingreso: abril-2003
Ubicación: Santiago Chile
Mensajes: 134
Antigüedad: 21 años, 1 mes
Puntos: 0
ayuda please con formulario

No se que esta mal con el archivo ayb.pl del CGI en http://www.aybmontajes.cl/pages/contacto.htm



/usr/bin/perl
$mail_prog = '/usr/sbin/sendmail' ;
# This script was generated automatically by Perl Builder(tm): http://www.solutionsoft.com

# ***ENDAUTOGEN:HEADER*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:INPUT*** Do NOT modify this line!! Do NOT enter custom code in this section.

&GetFormInput;

# The intermediate variables below make your script more readable
# but somewhat less efficient since they are not really necessary.
# If you do not want to use these variables, clear the
# Intermediate Variables checkbox in the Tools | Options dialog box, CGI Wizard tab.

$nombre = $field{'nombre'} ;
$empresa = $field{'empresa'} ;
$email = $field{'email'} ;
$ciudad = $field{'ciudad'} ;
$comentarios = $field{'comentarios'} ;
$Submit = $field{'Submit'} ;
$Reset = $field{'Reset'} ;

$message = "" ;
$found_err = "" ;

# ***ENDAUTOGEN:INPUT*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:VALIDATE*** Do NOT modify this line!! Do NOT enter custom code in this section.

$errmsg = "<p></p>\n" ;

if (length($nombre) > 1953393010) {
$message = $message.$errmsg ;
$found_err = 1 ; }


$errmsg = "<p>Por favor indíquenos su empresa</p>\n" ;

if ($empresa eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($empresa) < 5) {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($empresa) > 657930) {
$message = $message.$errmsg ;
$found_err = 1 ; }


$errmsg = "<p>Por favor ingrese su correo electrónico</p>\n" ;

if ($email !~ /.+\@.+\..+/) {
$message = $message.$errmsg ;
$found_err = 1 ; }


$errmsg = "<p>Por favor seleccione ciudad de destino</p>\n" ;

if ($ciudad eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($ciudad) < 5) {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($ciudad) > 168430090) {
$message = $message.$errmsg ;
$found_err = 1 ; }


$errmsg = "<p>Sus comentarios son obligatorios</p>\n" ;

if ($comentarios eq "") {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($comentarios) < 5) {
$message = $message.$errmsg ;
$found_err = 1 ; }

elsif (length($comentarios) > 168430090) {
$message = $message.$errmsg ;
$found_err = 1 ; }


$errmsg = "<p></p>\n" ;

if (length($Submit) > 263172) {
$message = $message.$errmsg ;
$found_err = 1 ; }

if ($found_err) {
&PrintError; }


# ***ENDAUTOGEN:VALIDATE*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:LOGFILE*** Do NOT modify this line!! Do NOT enter custom code in this section.

# ***ENDAUTOGEN:LOGFILE*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:EMAIL*** Do NOT modify this line!! Do NOT enter custom code in this section.


$recip = $ciudad ;

open (MAIL, "|$mail_prog -t");
print MAIL "To: $recip\n";
print MAIL "Reply-to: $email\n";
print MAIL "From: $email\n";
print MAIL "Subject: Contacto via web\n";
print MAIL "\n\n";
print MAIL "Nombre: ".$nombre."\n" ;
print MAIL "Empresa: ".$empresa."\n" ;
print MAIL "Email: ".$email."\n" ;
print MAIL "Cometarios:\n" ;
print MAIL "".$comentarios."\n" ;
print MAIL "\n\n";
close (MAIL);


$recip = $email ;

open (MAIL, "|$mail_prog -t");
print MAIL "To: $recip\n";
print MAIL "Reply-to: info\@aybmontajes.cl\n";
print MAIL "From: info\@aybmontajes.cl\n";
print MAIL "Subject: Formulario Procesado\n";
print MAIL "\n\n";
print MAIL "Estimado ".$nombre.":\n" ;
print MAIL "\n" ;
print MAIL " AyBMontajes ha procesado la consultas que nos ha\n" ;
print MAIL "envíado vía formulario de contacto de nuestro sitio web.\n" ;
print MAIL "\n" ;
print MAIL " Este mensaje es una confirmación del proceso y pronto\n" ;
print MAIL "recibirá una respuesta,\n" ;
print MAIL "\n" ;
print MAIL "El Equipo de AyBMontajes.\n" ;
print MAIL "www.aybmontajes.cl\n" ;
print MAIL "\n\n";
close (MAIL);

# ***ENDAUTOGEN:EMAIL*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:HTML*** Do NOT modify this line!! Do NOT enter custom code in this section.
print "Location: http://www.aybmontajes.cl/pages/procesado.htm\nURI: http://www.aybmontajes.cl/pages/procesado.htm\n\n" ;

# ***ENDAUTOGEN:HTML*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:ERRPRINT*** Do NOT modify this line!! Do NOT enter custom code in this section.

sub PrintError {
print "Content-type: text/html\n\n";
print $message ;

exit 0 ;
return 1 ;
}

# ***ENDAUTOGEN:ERRPRINT*** Do NOT modify this line!! You may enter custom code after this line.


# ***AUTOGEN:PARSE*** Do NOT modify this line!! Do NOT enter custom code in this section.
sub GetFormInput {

(*fval) = @_ if @_ ;

local ($buf);
if ($ENV{'REQUEST_METHOD'} eq 'POST') {
read(STDIN,$buf,$ENV{'CONTENT_LENGTH'});
}
else {
$buf=$ENV{'QUERY_STRING'};
}
if ($buf eq "") {
return 0 ;
}
else {
@fval=split(/&/,$buf);
foreach $i (0 .. $#fval){
($name,$val)=split (/=/,$fval[$i],2);
$val=~tr/+/ /;
$val=~ s/%(..)/pack("c",hex($1))/ge;
$name=~tr/+/ /;
$name=~ s/%(..)/pack("c",hex($1))/ge;

if (!defined($field{$name})) {
$field{$name}=$val;
}
else {
$field{$name} .= ",$val";

#if you want multi-selects to goto into an array change to:
#$field{$name} .= "\0$val";
}


}
}
return 1;
}


# ***ENDAUTOGEN:PARSE*** Do NOT modify this line!! You may enter custom code after this line.