Then I would add a little to the script:
Code:
#!/usr/bin/perl
use CGI; # Common Gateway Interface
use strict; # restrict sloppy constructs
use warnings; # enable warnings
my $file = qq(/var/tmp/output.txt); # tab-delimited output
my $query = CGI->new; # new CGI query
# HTTP headers and HTML head
print $query->header( -type=>"text/html", -charset=>"UTF-8" );
print qq(<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" lang="en-US" xml:lang="en-US">
<head>
<title>Form output</title>
</head>
);
my ($s,$m,$h,$day,$mon,$year) = localtime();
$year += 1900;
$mon++;
# get values of one single form field (user)
my @values = $query->param('user');
open ( TAB, ">>", $file )
or die ( "Could not open '$file' for appending: $!\n" );
foreach my $value ( @values ) {
print qq(v=),$value,qq(<br /> \n);
print TAB qq($year-$mon-$day $h:$m:$s\t),$value,"\n";
}
close ( TAB );
# Done
print qq(</body>\n</html>\n);
exit ( 0 );
The "Camel Book" is essential and the Cookbook is useful. If you want to change the location of your scripts look at the part of your Apache configuration around "ScriptAlias"
Bookmarks