Foros del Web » Programación para mayores de 30 ;) » Programación General »

ayuda please con formulario

Estas en el tema de ayuda please con formulario en el foro de Programación General en Foros del Web. 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 ...
  #1 (permalink)  
Antiguo 14/06/2004, 22:48
Avatar de rocl  
Fecha de Ingreso: abril-2003
Ubicación: Santiago Chile
Mensajes: 134
Antigüedad: 21 años
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.
  #2 (permalink)  
Antiguo 15/06/2004, 07:38
Avatar de monoswim
$moderador{'Esteban'}
 
Fecha de Ingreso: febrero-2002
Ubicación: Buenos Aires - Argentina
Mensajes: 8.762
Antigüedad: 22 años, 2 meses
Puntos: 90
El script no tiene nada

Mira, si el script fué generado por un programa como dice en su cabecera no creo que tenga el problema...Luego me fijé en tu formulario y aparece este error:

Not Found

The requested URL /pages/action= was not found on this server.
Apache/2.0.49 (Fedora) Server at www.aybmontajes.cl Port 80

Lo que dice que que no puede encontrar la URL del action que tienes en la etiqueta form. Te aconcejo que la pongas de manera absoluta:

http://www.midominio.com/cgi-bin/miscript.pl

y no coloques el ? al final de la linea

Prueba eso y luego dime como te fué
Suerte
__________________
Esteban Quintana
  #3 (permalink)  
Antiguo 15/06/2004, 07:54
Avatar de rocl  
Fecha de Ingreso: abril-2003
Ubicación: Santiago Chile
Mensajes: 134
Antigüedad: 21 años
Puntos: 0
hola gracias

<form name="form1" method="post" action="action="http://www.aybmontaje.cl/mainwebsite_cgi/ayb.pl">


Esto coloque en la linea de action
Ebn el hosting aybmontajes la carpeta donde esta el script se llama mainwebsite_cgi, el scripts se llama ayb.pl


Me fue mal me arroja a una pagina inexistente
URL http://www.aybmontajes.cl/pages/action=
Atención: Estás leyendo un tema que no tiene actividad desde hace más de 6 MESES, te recomendamos abrir un Nuevo tema en lugar de responder al actual.
Respuesta




La zona horaria es GMT -6. Ahora son las 16:09.