in reply to Re^3: Form processing from a flash swf
in thread Form processing from a flash swf

Sorry for the missing tags here goes again.... Thanx again for the time!
#! /usr/bin/perl # ---------------------------------------------------- $mailprog = '/usr/sbin/sendmail'; $cuenta = 'inscripciones@ceadmex.org'; # Get the Date for Entry $date = `date +"%A, %B %d, %Y at %T (%Z)"`; chop($date); $shortdate = `date +"%D %T %Z"`; chop($shortdate); # Get the input read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Split the name-value pairs @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; $FORM{$name} = $value; } # Alta a variables use CGI qw/:standard/; $EMPR = param('empr'); $APPA = param('appa'); $APMA = param('apma'); $NOMB = param('nomb'); $EMAL = param('emal'); $TELE = param('tele'); $DIRE = param('dire'); $COLO = param('colo'); $CIUD = param('ciud'); $ESTA = param('esta'); $PAIS = param('pais'); $COPO = param('copo'); $CURS = param('curs'); ################# Mandar Correo ############ open (MAIL, "|$mailprog $cuenta") || die "Can't open $mailprog!\n"; print MAIL "From: $EMAL\n"; print MAIL "Subject: DATOS\n\n"; print MAIL "--------------------------------------\n"; print MAIL "DATOS DE LA PERSONA\n"; print MAIL "Nombre: $NOMB $APPA $APMA\n"; print MAIL "Direccion: $DIRE $COLO $CIUD $ESTA $PAIS $COPO\n"; print MAIL "-----------------------------------\n"; print MAIL "DATOS DE LA RETROALIMENTACION\n"; print MAIL "EMPRESA: $EMPR $TELE\n"; print MAIL "CURSO" $CURS\n"; print MAIL "---------------------------------------\n"; print MAIL "-----------------------------------\n"; print MAIL "FECHA Y HORA DE ESTE FORMATO\n"; print MAIL " - $date\n"; print MAIL "---------------------------------------\n"; close (MAIL);

Replies are listed 'Best First'.
Re^5: Form processing from a flash swf
by cog (Parson) on Mar 12, 2005 at 13:55 UTC
    Let's start with some thoughts on your code:
    • First, use strict and use warnings. It will save you a lot of headaches in the long run; you will have to declare all your variables (with my, probably)
    • Second, don't use a system call to get the date; use localtime() instead (see `perldoc -f localtime`).

    Apart from that, I really don't see anything weird about your code. How are you testing it and how are you compiling it?