#!/usr/bin/perl
use strict;
use warnings;
use CGI qw/:standard -compile -nosticky/; $CGI:
ISABLE_UPLOADS=1;
use CGI::Carp qw/fatalsToBrowser/;
my
$cgi = new CGI;
$cgi->autoEscape(1);
# First lets check if there is already a cookie at user browser
my %cookie_data = $cgi->cookie('LastActions');
if ((exists $cookie_data{Book}) && (exists $cookie_data{Time}))
{
# some code goes here
print CGI::redirect("
http://www.cpan.org");
exit
}
print
$cgi->header(
-type => 'text/html',
-charset => 'UTF-8',
-encoding => 'UTF-8',
'-Content-Language' => 'el',
-lang => 'el-Greek',
-expires => '+10h',
-nph => 0,
-status => '200 ok'),
$cgi->start_html(
-title => 'Department Library',
-text => '#000080',
-bgcolor => 'white',
-head => Link({-rel=>'shortcut icon', -type=>'image/png',
-href=>'/favicon.ico'}));
print STDOUT<<STOP_PRINTING;
<style type="text/css">
..formfield { font-family: tahoma; font-size: 9pt; font-weight: 600;
color:#191970 ; background-color: #F0FFF0 }
..formbutton { font-family: tahoma; font-size: 9pt; font-weight: 700;
color:#191970 ; background-color: #F0F8FF }
</style>
STOP_PRINTING
print $cgi->start_multipart_form(-method=>'POST',
-enctype=>'multipart/form-data', -target=>'_self');
print q'<table
style="position:absolute;left:200px;top:150px;width:600px;z-index:0;"
cellpadding="0" cellspacing="1">
<tr><td colspan="2">'. $cgi->h3("Book check Application") .'</td></tr>
<tr><td style="height: 50px;"></td><td></td></tr>
<tr><td style="height: 40px; width: 80px;">Book</td><td>'.
$cgi->textfield
(
-name => 'Book',
-default => '',
-override => 1,
-maxlength => 80,
-size => 30,
-class => 'formfield'
)
..'</td></tr>
<tr><td style="height: 40px; width: 80px;">Shelf</td><td>'.
$cgi->textfield
(
-name => 'Shelf',
-default => '',
-override => 1,
-maxlength => 80,
-size => 30,
-class => 'formfield'
)
..'</td></tr>
<tr><td style="height: 40px;"></td><td></td></tr>
<tr><td colspan="2">'.
$cgi->submit( -name =>'SUBMIT', -value=>"Check",
-class=>'formbutton'). '  '.
$cgi->defaults(-name =>'RESET', -value=>"Reset", -class=>'formbutton')
..'</td></tr>
</table>';
print $cgi->end_multipart_form();
if ( defined $cgi->param('SUBMIT') )
{
print $cgi->redirect( -uri => "
http://www.cpan.org", -cookie =>
cookie(-name=>'LastActions', -path=>'/', -secure=>0, -expires=>'+2h',
-value=>{ Book => $cgi->param('Book'), Shelf => $cgi->param('Shelf') } ) );
exit;
}
print $cgi->end_html();
exit 0;