
cailet
Deleted
Jun 3, 2000, 4:53 PM
Post #1 of 3
(345 views)
|
|
form processing w/ time stamp
|
Can't Post
|
|
I have this script that writes to html the results of a form. but I want to add a time stamp of when the form was processed. Can someone help me rewrite this? # Get the input data read(STDIN, $buffer, $ENV{'CONTENT_LENGTH'}); # Parse the data @pairs = split(/&/, $buffer); foreach $pair (@pairs) { ($name, $value) = split(/=/, $pair); # get rid of the % encoding $value =~ tr/+/ /; $value =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $name =~ tr/+/ /; $name =~ s/%([a-fA-F0-9][a-fA-F0-9])/pack("C", hex($1))/eg; $value =~ s/<!--(.|\n)*-->//g; if(! $allow_html) { $value =~ s/<([^>]|\n)*>//g; } $FORM{$name} = $value; } open(FILES, "$file") | | die "Can't open FILE: $file\n"; @files =<FILES>; close(FILES); open(FILES, ">$file") | | die "Can't open FILE: $file\n"; foreach $line (@files) { if($line =~ /<!--Begin Directory-->/i) { if($top) { print FILES "<!--Begin Directory-->\n"; } print FILES "<tr><td align=center>$FORM{'artist'}</font></td><td align=center><em>$FORM{'song'}</em></td><td align=center><b>$FORM{'name'}</b></td><td align=center><a href=mailto:$FORM{'contact'}>$FORM{'do'}</a></td></tr>\n"; if(! $top) { print FILES "<!--Begin Directory-->\n"; } } else { print FILES "$line"; } } close(FILES); print "Location: $gto\n\n";
|