smanicka has asked for the wisdom of the Perl Monks concerning the following question:
And the second page#!/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 fo +r 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 "<font color=\"#FFFDCC\"><CENTER> <CENTER> <h1>Company</h1><br>< +hr><br><br><br>"; print $cgi-> start_form({ ## starts a new form that would call ad +dusr.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 "<br>"; print $cgi-> start_form({ ## starts a new form that would call ad +dusr.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 "<br>"; if ($usr eq "admin"){ #-------------------------------# print $cgi-> start_form({ ## starts a new form that would call ad +dusr.pl -action => "alterDSDBUSR.pl", -method => "POST", }); &hidden_fields(); print $cgi->submit({ -name => "alterDSDBUSR", -value => " Manage Users ", }); print $cgi->end_form(); print "<br>"; } #-------------------------------# print $cgi-> start_form({ ## starts a new form that would call ad +dusr.pl -action => "logout.pl", -method => "POST", }); &hidden_fields(); print $cgi->submit({ -name => "logoutDSDB", -value => " Logout ", }); print $cgi->end_form(); #-------------------------------# print "<br><br><br><hr> Please wait .Don\'t use the browser\'s buttons + to move back and forth.</CENTER><br>"; print $cgi->end_html(); } else { print $cgi->start_html( -title => "Main Menu", -bgcolor=> "#003399", ); print "<font color=\"#FFFDCC\"><CENTER> <CENTER> <h1> Company</h1><br> +<hr><br><br><br>"; print "<h2> You are not logged in.Session expired.<br>Log in again</h2 +><br>"; $sid = undef; $uid = undef; $lgn = undef; &hidden_fields(); #-------------------------------# print $cgi-> start_form({ ## starts a new form that would call ad +dusr.pl -action => "loginDb.pl", -method => "POST", }); &hidden_fields(); print $cgi->submit({ -name => "Login", -value => "Go to Login Page", }); print $cgi->end_form(); print "<br><br><br><hr> Please wait .Don\'t use the browser\'s buttons + to move back and forth.</CENTER><br>"; 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 ); }
Thanks#!/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 fo +r the page based on login print "Pragma:no-cache", "\n\n"; #$session = CGI::Session->load(); my $cgi=CGI->new(); #my $lgn=$session->param("user"); #print "user : $lgn\n"; $sid = param("session_id"); $usr=param("uid"); $lgn=param("login"); $type=param("type"); #print "Login :$lgn\t$usr\n"; if ($lgn == 1){ print $cgi->start_html( -title => "Main Menu", -bgcolor=> "#003399", #-cookie=> $cookie ); print "<font color=\"#FFFDCC\"><CENTER> <CENTER> <h1> Company</h1><br> +<hr><br>"; print "$type<br>"; print $cgi->start_form( -method =>"post", -action =>"doinsertdsdb.pl" ); print $cgi->hidden( -name => "type", -value => $type ); &hidden_fields(); print "<br>"; print $cgi->submit( -name => "Submit", -value =>"Insert" ); print $cgi->end_form(); print $cgi->start_form( -method =>"post", -action =>"dodeletedsdb.pl" ); print $cgi->hidden( -name => "type", -value => $type ); &hidden_fields(); print "<br>"; print $cgi->submit( -name => "Submit", -value =>"Delete" ); print $cgi->end_form(); print $cgi->start_form( -method =>"post", -action =>"doupdatedsdb.pl" ); print $cgi->hidden( -name => "type", -value => $type ); &hidden_fields(); print "<br>"; print $cgi->submit( -name => "Submit", -value =>"Update" ); print $cgi->end_form(); print $cgi->start_form( -method =>"post", -action =>"dsdb_menu.pl" ); print $cgi->hidden( -name => "type", -value => "" ); &hidden_fields(); print "<br>"; print $cgi->submit( -name => "Submit", -value =>"Back to Main Menu" ); print $cgi->end_form(); print "<br><br><br><hr>Don\'t use the browser\'s buttons to move back +and forth.</CENTER><br>"; print $cgi->end_html(); } else{ print $cgi->start_html( -title => "Main Menu", -bgcolor=> "#003399", #-cookie=> $cookie ); print "<font color=\"#FFFDCC\"><CENTER> <CENTER> <h1> Company </h1><br +><hr><br><br><br>"; print "<h2> You are not logged in.Session expired.<br>Log in again</h2 +><br>"; $sid = undef; $uid = undef; $lgn = undef; &hidden_fields(); #-------------------------------# print $cgi-> start_form({ ## starts a new form that would call ad +dusr.pl -action => "loginDb.pl", -method => "POST", }); &hidden_fields(); print $cgi->submit({ -name => "Login", -value => "Go to Login Page", }); print $cgi->end_form(); print "<br><br><br><hr> Please wait .Don\'t use the browser\'s buttons + to move back and forth.</CENTER><br>"; 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 ); }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: perl cgi-pages remember previous entries.How to get over this?
by afoken (Chancellor) on Mar 24, 2009 at 20:06 UTC | |
by ikegami (Patriarch) on Mar 24, 2009 at 20:32 UTC | |
|
Re: perl cgi-pages remember previous entries.How to get over this?
by Herkum (Parson) on Mar 24, 2009 at 21:35 UTC |