# This code is provided "as is" with NO WARRANTY expressed or # implied. You may use it freely at your own risk. #!/usr/bin/perl use CGI; # let the shell know where gpg can find its key rings # be sure the rings are readable by the Web server # and in a directory that's readable $ENV('GNUPGHOME') = '/home/httpd/cgi-bin'; # to use PGP, comment out the previous line # and uncomment the following line # $ENV('PGPPATH') = '/home/httpd/cgi-bin'; my $query = new CGI; print $query->header; # we could combine the next two major steps in one loop, but for # clarity we're going to repeat ourselves # # first we mail it # stamping each mail msg w/ GM Time my $mailData = gmtime() . "\n"; my @params = $query->param; foreach my $param(@params) { my $val = $query->param($param); $mailData .= "$param:\t\t$val\n"; } # print any stderr to a file named errors # when you get tired of looking at this file, change the # output to 2>/dev/null # this next line does GnuPG my $cryptData = `echo "$mailData" | gpg -ear Webmaster --ciper-algo CAST5 2>>errors`; # the next line does the same w/ PGP # my $cryptData = `echo "$mailData" | pgp -feat Webmaster +ciphernum=3 2>>errors`; open(MAIL, "| /bin/mail -s 'Web form data' formmail\@darkspell.com"); print MAIL "$cryptData\n\n"; close MAIL; # then we save it to a file my $fileData = ""; foreach $param(@params) { $val = $query->param($param) $fileData .= "$val\t"; } chop($fileData); # stamp it with Greenwich Mean Time my $timestamp = gmtime(); $timestamp .= "\t$fileData"; # GnuPG $cryptData = `echo "$ftimestamp" | gpg -ear Webmaster --ciper-algo CAST5 2>/dev/null`; # PGP: # $cryptData = `echo "$ftimestamp" | pgp -feat Webmaster +cipernum=3 2>/dev/null`; open(DATA, ">>/home/data/form_data.txt"); print DATA "$timestamp\n"; print DATA "##############\n"; close DATA; print < Thanks for your thoughts!

Thanks for using our form

We appreciate the time you took to let us know what you're thinking. Don't worry, your comments have been encrypted and we will guard your privacy with the utmost caution. EOT