Hello. I have one problem with this script.
I insert the line &inc("login_admin.html");
for read my html document, but don't work. I want help, please.
Thank you.


This is my pl script:
#!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; }
This is my HTML:
<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>

In reply to Problem with my .pl script. Helpppp! by webstudioro

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.