Ver Mensaje Individual
  #8 (permalink)  
Antiguo 27/11/2011, 20:11
Avatar de emprear
emprear
Colaborador
 
Fecha de Ingreso: junio-2007
Ubicación: me mudé
Mensajes: 8.388
Antigüedad: 16 años, 10 meses
Puntos: 1567
Respuesta: Formulario de contacto en html

@zerokilled

Por lo que se puede apreciar, @estudiosol está usando una tradicional script escrita en Perl, llamada FormMail Cgi (http://www.scriptarchive.com/readme/formmail.html), yo la usé incluso durante mucho tiempo antes de migrar a PHP y suele venir preinstalada en muchos servidores

La validación la realiza la misma script a través de la correcta configuración de los campos. Se vale a si mismo de determinados campos de tipo hidden para pasar información entre la script y el formulario, a saber

Código HTML:
Ver original
  1. Necessary Form Fields
  2.  
  3. There is only one form field that you must have in your form, for FormMail to work correctly. This is the recipient field.
  4.  
  5. Field:  recipient
  6. Description:  This form field allows you to specify to whom you wish for your form results to be mailed. Most likely you will want to configure this option as a hidden form field with a value equal to that of your e-mail address.
  7.  
  8. As of version 1.8, You can include multiple recipients by separating the values with commas.
  9. Syntax:  <input type=hidden name="recipient" value="[email protected]"> OR
  10. <input type=hidden name="recipient" value="[email protected],[email protected]">

es decir que el campo de nombre recipient esta diseñado para indicar el ó las direcciones de correo del destinatario...

Código HTML:
Ver original
  1. Field:  email
  2. Description:  This form field will allow the user to specify their return e-mail address. If you want to be able to return e-mail to your user, I strongly suggest that you include this form field and allow them to fill it in. This will be put into the From: field of the message you receive. If you want to require an email address with valid syntax, add this field name to the required field.
  3. Syntax:  <input type=text name="email">

el campo de nombre email valida la sintáxis de email de dicho campo,

Código HTML:
Ver original
  1. Field:  required
  2. Version:  1.3 & Up
  3. Description:  You can now require for certain fields in your form to be filled in before the user can successfully submit the form. Simply place all field names that you want to be mandatory into this field. If the required fields are not filled in, the user will be notified of what they need to fill in, and a link back to the form they just submitted will be provided.
  4.  
  5. To use a customized error page, see missing_fields_redirect
  6. Syntax:  If you want to require that they fill in the email and phone fields in your form, so that you can reach them once you have received the mail, use a syntax like:
  7.  
  8. <input type=hidden name="required" value="email,phone">
este es esencialmente el que parece estar faltándole a @estudiosol, ese campo oculto, de nombre "required", tiene por valor, el ó los nombres separados por comas, de los campos que sean obligatorios
en su ejemplo, por ejemplo
<input type=hidden name="required" value="email,subject,nombrevisitante">

solo para ampliar, la validación de campos requeridos se realiza con

Código perl:
Ver original
  1. sub check_required {
  2.  
  3.     # Localize the variables used in this subroutine.                        #
  4.     local($require, @error);
  5.  
  6.     # The following insures that there were no newlines in any fields which  #
  7.     # will be used in the header.                                            #
  8.     if ($Config{'subject'} =~ /(\n|\r)/m || $Config{'email'} =~ /(\n|\r)/m ||
  9.         $Config{'realname'} =~ /(\n|\r)/m || $Config{'recipient'} =~ /(\n|\r)/m) {
  10.         &error('invalid_headers');
  11.     }
  12.  
  13.     # Fix XSS + HTTP Header Injection for v1.93
  14.     foreach $lfield ('redirect', 'return_link_url') {
  15.         # Strip new lines
  16.         $Config{$lfield} =~ s/(\n|\r)//mg;
  17.  
  18.         # Only allow certain handlers to avoid javascript:/data: tricks
  19.         if ($Config{$lfield} !~ /^\s*\// &&
  20.             $Config{$lfield} !~ /^\s*(http|https|ftp):\/\//) {
  21.             $Config{$lfield} = '';
  22.         }
  23.     }
  24.  
  25.     if (!$Config{'recipient'}) {
  26.         if (!defined(%Form)) { &error('bad_referer') }
  27.         else                 { &error('no_recipient') }
  28.     }
  29.     else {
  30.         # This block of code requires that the recipient address end with    #
  31.         # a valid domain or e-mail address as defined in @recipients.        #
  32.         foreach $send_to (split(/,/,$Config{'recipient'})) {
  33.             foreach $recipient (@recipients) {
  34.                 if ($send_to =~ /$recipient$/i) {
  35.                     push(@send_to,$send_to); last;
  36.                 }
  37.             }
  38.         }
  39.         if ($#send_to < 0) { &error('no_recipient') }
  40.         $Config{'recipient'} = join(',',@send_to);
  41.     }
  42.  
  43.     # For each require field defined in the form:                            #
  44.     foreach $require (@Required) {
  45.  
  46.         # If the required field is the email field, the syntax of the email  #
  47.         # address if checked to make sure it passes a valid syntax.          #
  48.         if ($require eq 'email' && !&check_email($Config{$require})) {
  49.             push(@error,$require);
  50.         }
  51.  
  52.         # Otherwise, if the required field is a configuration field and it   #
  53.         # has no value or has been filled in with a space, send an error.    #
  54.         elsif (defined($Config{$require})) {
  55.             if ($Config{$require} eq '') { push(@error,$require); }
  56.         }
  57.  
  58.         # If it is a regular form field which has not been filled in or      #
  59.         # filled in with a space, flag it as an error field.                 #
  60.         elsif (!defined($Form{$require}) || $Form{$require} eq '') {
  61.             push(@error,$require);
  62.         }
  63.     }
  64.  
  65.     # If any error fields have been found, send error message to the user.   #
  66.     if (@error) { &error('missing_fields', @error) }
  67. }
La documentación de la script esta muy detallada (en inglés), pero de segiro si busca, va a encontrar más de un tutorial es español para la Matt's Script FormMail CGI
Saludos
__________________
La voz de las antenas va, sustituyendo a Dios.
Cuando finalice la mutación, nueva edad media habrá
S.R.