#!/usr/bin/perl
use DBI;
use CGI qw(:standard); # indicates that this program requires CGI module to run,to load it
use CGI::Session ( '-ip_match' );
print "Content-type:text/html\n"; # prints the html header for the page based on login
print "Pragma: no-cache", "\n\n";
my $cgi=CGI->new();
$sid = param("session_id");
$usr=param("uid");
$lgn=param("login");
if ($lgn == 1){
print $cgi->start_html(
-title => "Main Menu",
-bgcolor=> "#003399",
);
print "
Company
";
print $cgi-> start_form({ ## starts a new form that would call addusr.pl
-action => "alterDSDB.pl",
-method => "POST",
});
&hidden_fields();
print $cgi->hidden(
-name => "type",
-value => "PDF"
);
print $cgi->submit({
-name => "alterDSDB",
-value => "Alter PDF",
});
print $cgi->end_form();
print "
";
print $cgi-> start_form({ ## starts a new form that would call addusr.pl
-action => "alterDSDB.pl",
-method => "POST",
});
&hidden_fields();
print $cgi->hidden(
-name => "type",
-value => "ASCII"
);
print $cgi->submit({
-name => "alterDSDBA",
-value => "Alter ASCII",
});
print $cgi->end_form();
print "
";
if ($usr eq "admin"){
#-------------------------------#
print $cgi-> start_form({ ## starts a new form that would call addusr.pl
-action => "alterDSDBUSR.pl",
-method => "POST",
});
&hidden_fields();
print $cgi->submit({
-name => "alterDSDBUSR",
-value => " Manage Users ",
});
print $cgi->end_form();
print "
";
}
#-------------------------------#
print $cgi-> start_form({ ## starts a new form that would call addusr.pl
-action => "logout.pl",
-method => "POST",
});
&hidden_fields();
print $cgi->submit({
-name => "logoutDSDB",
-value => " Logout ",
});
print $cgi->end_form();
#-------------------------------#
print "
Please wait .Don\'t use the browser\'s buttons to move back and forth.
";
print $cgi->end_html();
}
else {
print $cgi->start_html(
-title => "Main Menu",
-bgcolor=> "#003399",
);
print " Company
";
print " You are not logged in.Session expired.
Log in again
";
$sid = undef;
$uid = undef;
$lgn = undef;
&hidden_fields();
#-------------------------------#
print $cgi-> start_form({ ## starts a new form that would call addusr.pl
-action => "loginDb.pl",
-method => "POST",
});
&hidden_fields();
print $cgi->submit({
-name => "Login",
-value => "Go to Login Page",
});
print $cgi->end_form();
print "
Please wait .Don\'t use the browser\'s buttons to move back and forth.
";
print $cgi->end_html();
}
sub hidden_fields(){
print $cgi->hidden(
-name => "session_id",
-value => $sid
);
print $cgi->hidden(
-name => "uid",
-value => $authuser
);
print $cgi->hidden(
-name => "login",
-value => 1
);
}
sub hidden_fields(){
print $cgi->hidden(
-name => "session_id",
-value => $sid
);
print $cgi->hidden(
-name => "uid",
-value => $authuser
);
print $cgi->hidden(
-name => "login",
-value => 1
);
}