Custom form handlers

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

hello, I took some of your advice and found a program that made a .cgi form handler at http://oneseek.com/formmail.htm. I followed their instructions as best I can. I put their script in my cg-bin and made the log file. Now here is what I am hoping you can help with. Does anything need to go into the encoding box and is the form still "post" or "get". I just can't seem to get the thing to work. I just made a quick test page to see how this all works at indywestwrestling.com/form_test.htm. thanks for any suggestions.
 
hey thought the code they gave might be useful

#!/usr/bin/per
$mail_prog = '$mail_prog = '/usr/sbin/sendmail''
# This script was generated automatically by Visual Form Mail: http://www.oneseek.co

&GetFormInput

$T1 = $field{'T1'} ;
$T2 = $field{'T2'} ;
$T3 = $field{'T3'} ;
$C1 = $field{'C1'} ;
$R1 = $field{'R1'} ;
$B1 = $field{'B1'} ;
$B2 = $field{'B2'} ;

$recip = "indywest\@indywest.com"
$frm_ = "web mail"
$sbj_ = "form"
$hd_ = $recip.$frm_.$sbj
if (($hd =~ /(\n|\r)/m) || ($recip =~ /(@.*@)|(\.\.)|(@\.)|(\.@)|(^\.)/) || ($recip !~ /^.+\@(\[?)[a-zA-Z0-9\-\.]+\.([a-zA-Z0-9]+)(\]?)$/))
print "Fatal Error - Invalid email" ;
exit 0;


open (MAIL, "|$mail_prog -t")
print MAIL "To: $recip\n"
print MAIL "Reply-to: $frm_\n"
print MAIL "From: $frm_\n"
print MAIL "Subject: $sbj_\n"
print MAIL "\n\n"
print MAIL "".$T1."\n"
print MAIL "".$T2."\n"
print MAIL "".$T3."\n"
print MAIL "".$C1."\n"
print MAIL "".$R1."\n"
print MAIL "".$B1."\n"
print MAIL "".$B2."\n"
print MAIL "\n\n"
close (MAIL)
print "Location: http://www.indywestwrestling.com\nURI: http://www.indywestwrestling.com\n\n"
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
 
Basically the sample form looks fine, with the following notes:

<form method="POST" action="http://indywestwrestling.com/.panel/cgi-bin/trial.cgi">
<p><input type="text" name="T1" size="20"></p>
<p><input type="text" name="T2" size="20"></p>
<p><input type="text" name="T3" size="20"></p>
<p><input type="checkbox" name="C1" value="ON"></p>
<p><input type="radio" value="V1" checked name="R1"></p>
<p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
</form>

Notes:

The path listed in the action is not valid, the cgi-bin can't be found.
The method would be Post, as shown.
Assign meaningful names to each fields

--
==============================================
Thomas A. Rowe (Microsoft MVP - FrontPage)
WEBMASTER Resources(tm)

FrontPage Resources, WebCircle, MS KB Quick Links, etc.
==============================================


Matthew said:
hello, I took some of your advice and found a program that made a .cgi form handler at
http://oneseek.com/formmail.htm. I followed their instructions as best I can. I put their script in
my cg-bin and made the log file. Now here is what I am hoping you can help with. Does anything need
to go into the encoding box and is the form still "post" or "get". I just can't seem to get the
thing to work. I just made a quick test page to see how this all works at
indywestwrestling.com/form_test.htm. thanks for any suggestions.
 
PS
You also need to check w/ your host in the location of their Perl and Sendmail, then edit the script at

#!/usr/bin/perl
$mail_prog = '$mail_prog = '/usr/sbin/sendmail'' ;

And convert cgi-bin to a subweb so you can manage permissions in it w/ FTP
--




| Basically the sample form looks fine, with the following notes:
|
| <form method="POST" action="http://indywestwrestling.com/.panel/cgi-bin/trial.cgi">
| <p><input type="text" name="T1" size="20"></p>
| <p><input type="text" name="T2" size="20"></p>
| <p><input type="text" name="T3" size="20"></p>
| <p><input type="checkbox" name="C1" value="ON"></p>
| <p><input type="radio" value="V1" checked name="R1"></p>
| <p><input type="submit" value="Submit" name="B1"><input type="reset" value="Reset" name="B2"></p>
| </form>
|
| Notes:
|
| The path listed in the action is not valid, the cgi-bin can't be found.
| The method would be Post, as shown.
| Assign meaningful names to each fields
|
| --
| ==============================================
| Thomas A. Rowe (Microsoft MVP - FrontPage)
| WEBMASTER Resources(tm)
|
| FrontPage Resources, WebCircle, MS KB Quick Links, etc.
| ==============================================
| To assist you in getting the best answers for FrontPage support see:
| http://www.net-sites.com/sitebuilder/newsgroups.asp
|
| | > hello, I took some of your advice and found a program that made a .cgi form handler at
| http://oneseek.com/formmail.htm. I followed their instructions as best I can. I put their script in
| my cg-bin and made the log file. Now here is what I am hoping you can help with. Does anything need
| to go into the encoding box and is the form still "post" or "get". I just can't seem to get the
| thing to work. I just made a quick test page to see how this all works at
| indywestwrestling.com/form_test.htm. thanks for any suggestions.
|
|
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Back
Top