#! /path/to/perl -wT # THis is the login validation script # Import CGI module use strict; use CGI qw(:all delete_all escapeHTML); use common_subs; use "path/to/other/modules/"; # Create a new CGI object my $query = new CGI; # Create query objects to retrieve input my $username=$query->param('user'); my $passwd=$query->param('password'); my $next_page = "http://somepage.com"; my $loginOK = check_login($username,$passwd); print $query->header; print $query->start_html(-title=>'Validate Login',-bgcolor=>'white', -style=>{src=>'/IMG_PATH/templatestyles.css'}); # This is the common header defined in common_subs and # I use that in all scripts &display_header("Check Login"); if ($loginOK == 1) { print $query->b("Login successful! Loading next page....\n"); print $query->start_form(-name=>'data',-action=>$next_page); print $query->end_form(); print $query->script("setTimeout(\"document.data.submit();\",5000);"); } else{ print $query->font({-color=>"red"},$query->p("Login Failed!!!"), $query->br(), $query->p("Please go back to login screen and enter correct userid and password!!!")); ... etc... ... } # This is the common footer defined in common_subs and # I use that in all scripts &display_footer; print $query->end_html(); #### use CGI qw/:standard :html3 :all/; use strict; sub check_login{ .... } sub display_header { my $disp_text=$_[0]; # Note that I have to create a new CGI object here in the sub my $query = new CGI; print $query->center; print $query->table( { -border=>0}, Tr([ td( {-align=>"center" },[ $query->img({-align=>"center", -src=>"logo.gif ", -border=>0 }), $query->font({-size=>'4'},$query->b( $disp_text)), ]), ]), ); } sub display_footer{ ... ... }