#!perl use warnings; use CGI qw(:standard); use CGI::Cookie; use CGI; $query = CGI->new(); $user = "test"; $pws = "1234"; $nameCookie = "mm56"; $valueCookie = "012355"; $html_path = "c:/indigoperl/htdocs"; &inc("login_admin.html"); if ($query->param('logout') eq "yes") { &logout; } if ($query->param('login') eq "yes") { if ($query->param('user') eq ""){ print $query->header(-type=>'text/html'); print "Enter your User name."; exit; } if ($query->param('pws') eq ""){ print $query->header(-type=>'text/html'); print "Enter your password."; exit; } if (($query->param('user') eq "$user") && ($query->param('pws') eq "$pws")) { my %cookie = CGI::Cookie->fetch; my $cookie = CGI::Cookie->new(-name=>$nameCookie,-value=>$valueCookie,-expires=>'+23h'); print header(-cookie=>$cookie); print "welcome\n"; exit; } print $query->header(-type=>'text/html'); print "Your User name / Password it's not good."; exit; } sub inc { %lvals = ( "!CGI_URL!","$cgi_url", ); local (%livals)=%lvals; local ($htfile)=@_; local ($htmlPath)="$html_path/$htfile"; open(TEMPLATE, "<$htmlPath") || die "Cannot open file: $htmlPath for read! Error: $!\n"; $htmlPath=""; while() { $htmlPath .= $_; } close(TEMPLATE); for $ikey (keys(%livals)) { local($value)=$livals{"$ikey"}; $htmlPath =~ s/$ikey/$value/gm; } print "$htmlPath\n"; return; } #### Admin. Area Admin. Area Enter your user name and password User name: Password:
## Admin. Area Admin. Area Enter your user name and password User name: Password: