comparison cgi-bin/comments.cgi @ 99:cd27fd555272

Use a better date + time format.
author Steve Kemp <steve@steve.org.uk>
date Wed, 12 Dec 2007 17:33:22 +0000
parents 3d8b0e615bf3
children a25099606ec5
comparison
equal deleted inserted replaced
98:3d8b0e615bf3 99:cd27fd555272
12 12
13 13
14 14
15 use strict; 15 use strict;
16 use warnings; 16 use warnings;
17
17 use CGI; 18 use CGI;
19 use POSIX qw(strftime);
20
21
18 22
19 # 23 #
20 # The directory to store comments in 24 # The directory to store comments in
21 # 25 #
22 my $COMMENT = $ENV{'DOCUMENT_ROOT'} . "../comments/"; 26 my $COMMENT = $ENV{'DOCUMENT_ROOT'} . "../comments/";
57 61
58 62
59 # 63 #
60 # get the current time 64 # get the current time
61 # 65 #
62 my ($sec,$min,$hour,$mday,$mon,$year,$wday,$yday,$isdst) = 66 my $timestr = strftime "%e-%B-%Y-%H:%M:%S", gmtime;
63 localtime(time);
64 67
65 # 68 #
66 # Open the file. 69 # Open the file.
67 # 70 #
68 my $file = $COMMENT . "/" . $id . "." . "$mday-$mon-$year-$hour-$min-$sec"; 71 my $file = $COMMENT . "/" . $id . "." . $timestr;
69 open( FILE, ">", $file ); 72 open( FILE, ">", $file );
70 print FILE "Name: $name\n"; 73 print FILE "Name: $name\n";
71 print FILE "Mail: $mail\n"; 74 print FILE "Mail: $mail\n";
72 print FILE "User-Agent: $ENV{'HTTP_USER_AGENT'}\n"; 75 print FILE "User-Agent: $ENV{'HTTP_USER_AGENT'}\n";
73 print FILE "IP-Address: $ENV{'REMOTE_ADDR'}\n"; 76 print FILE "IP-Address: $ENV{'REMOTE_ADDR'}\n";