CGI-ContactForm
view release on metacpan or search on metacpan
lib/CGI/ContactForm.pm view on Meta::CPAN
unless ( $ENV{HTTP_COOKIE} and ($cookie) = $ENV{HTTP_COOKIE} =~ /\bContactForm_time=(\d+)/ ) {
CFdie("Your browser is set to refuse cookies.<br>\n"
. "Change that setting to accept at least session cookies, and try again.\n");
}
open FH, File::Spec->catfile( $tempdir, 'ContactForm_time' )
or die "Couldn't open timestamp file: $!";
chomp( my @timestamps = <FH> );
close FH or die $!;
if ( $cookie + 7200 < $time or ! grep $cookie eq $_, @timestamps ) {
settimestamp($tempdir, $time);
CFdie("Timeout due to more than an hour of inactivity.\n"
. '<p><a href="javascript:history.back(1)">Go back one page</a> and try again.');
}
}
sub settimestamp {
my ($tempdir, $time) = @_;
$tempdir ||= $CGITempFile::TMPDIRECTORY;
sysopen FH, File::Spec->catfile( $tempdir, 'ContactForm_time' ), O_RDWR|O_CREAT
or die "Couldn't open timestamp file: $!";
( run in 0.244 second using v1.01-cache-2.11-cpan-4d50c553e7e )