webstudioro has asked for the wisdom of the Perl Monks concerning the following question:
This is my HTML:#!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 "<font color=\"red\">Enter your User name.</font>"; exit; } if ($query->param('pws') eq ""){ print $query->header(-type=>'text/html'); print "<font color=\"red\">Enter your password.</font>"; exit; } if (($query->param('user') eq "$user") && ($query->param('pws') eq "$p +ws")) { 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.<br>"; 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 r +ead! Error: $!\n"; $htmlPath=""; while(<TEMPLATE>) { $htmlPath .= $_; } close(TEMPLATE); for $ikey (keys(%livals)) { local($value)=$livals{"$ikey"}; $htmlPath =~ s/$ikey/$value/gm; } print "$htmlPath\n"; return; }
<html> <head> <title>Admin. Area</title> </head> <body><br><br><br><center><h3>Admin. Area</h3></center><br> <table align=center border=0> <form action="!CGI_URL!/test.pl?login=yes" method="post"> <tr><td align=center colspan=2> <b>Enter your user name and password</b></td></tr> <tr><td> User name: </td> <td> <input type=text name="user"></td></tR> <tr><td> Password: </td> <td> <input type=password name="pws"></td></tr> <tr><td colspan=2 align=center> <input type=submit value="Login to Admin. Area"> </td></tR> <tr><td align=center colspan=2> <hr> </td></tr> </form> </table> </body></html>
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Problem with my .pl script. Helpppp!
by PodMaster (Abbot) on Aug 31, 2003 at 11:05 UTC | |
by fraktalisman (Hermit) on Aug 31, 2003 at 12:25 UTC | |
by antirice (Priest) on Aug 31, 2003 at 14:23 UTC | |
by webstudioro (Acolyte) on Aug 31, 2003 at 14:22 UTC | |
by webstudioro (Acolyte) on Aug 31, 2003 at 14:17 UTC | |
by PodMaster (Abbot) on Aug 31, 2003 at 14:30 UTC | |
by webstudioro (Acolyte) on Aug 31, 2003 at 17:00 UTC | |
by jeffa (Bishop) on Aug 31, 2003 at 18:16 UTC | |
| |
by chanio (Priest) on Aug 31, 2003 at 18:15 UTC |