Hello Everybody

Here is the code

print"Content-type:text/html\n\n";

read (STDIN, $data, $ENV{'CONTENT_LENGTH'}); #$data = Buffer which holds
the
querystring
@info = split(/&/, $data);

foreach $pair(@info)
{
 ($name, $value) = split(/=/,$pair);
 $value =~ tr/+/ /;
 $value =~ s/%([\dA-Fa-f] [\dA-Fa-f])/pack("C", hex($1))/eg;
 $FORM{$name} = $value;
}

$username=$FORM{'uname'};

#Encrypting password
$password = $FORM{'pass'};
$encryptedpass = crypt($password, "");

open PASS,"user.dat";

while(<PASS>)
{
 chomp;
 my($fname,$lname,$uname,$pass,$add,$city)=split(/\|/,$_);
 if($uname eq $username)
 {
  if($pass eq $encryptedpass)
  {
  HERE, I WANT TO OPEN A EXISTING HTML FILE
BY NAME QUEST.HTML. WHAT SHOULD I DO.
PLEASE CLARIFY ME
last;
  }
  else
  {

   print "<html><head>";
          print "<title>PASSWORD MISMATCH </title></head>";
    print "<body><h1><p align =\"center\"><font
color=\"#000FF\">Password
Mismatch....</font></p></h1>";
   print "<br><hr>";
                # print "Login Name: <input type=text name=\"username\"
value=\"$username\"
size=15>";
  # print "<br><br>";
  # print "Password: <input type=text name=\"password\">";
  # print "<br>";
   print "<b><h2>Please fill in the correct password.<h2></b>";
   print "<br>";
   print "<b><i>Return to the <a href=\"frame.html\">Login
page</b></i></a>.";
                 print "<br><br><hr>";
   last;
  }

 }
 else
 {
  print "<html><head>";
          print "<title>INVALID USER</title></head>\n";
   print "<body><h1><p align =\"center\"><font color=\"#000FF\">Invalid
User
name....</font></p></h1>";
   print "<br><hr>";
                # print "Login Name: <input type=text
name=\"username\"";
  # print "Please fill in the correct password\n";
   print "<b><h2>Please fill in the correct username.<h2></b>";
   print "<br>";
   print "<b><i>Return to the <a href=\"frame.html\">Login
page</b></i></a>.";
                 print "<br><br><hr>";
  last;
 }
}

Mark Bergeron wrote:

  If you paste a little code into your email we may be able to give you
better advice.

  The most common way though would be to use a "here" document inside of
the script like
  so:

  if (your_condition eq 'T'){
      print <<EOF;
      Content-type: text/html
      <html>
      <head>
        <title>Your Page</title>
      </head>

      <body bgcolor="#ffffff">
      etc... other HTML here
      </body>
      </html>
      EOF
  } else {
      do something else....
  }

  you get the picture.

  GL,
  Mark Bergeron

  -----Original Message-----
  From: "Srinivasan Kannan"<[EMAIL PROTECTED]>
  To: "CGI"<[EMAIL PROTECTED]>
  Date: Thu Jul 05 12:14:47 PDT 2001
  Subject: Opening HTML file from PERL

  >Hai Everybody
  >
  >            Iam new user to PERL and Iam now doing a small project.
In
  >my project, HTML form values such as username and password are
validated
  >in a Perl file and depending upon the validation result, I'll be
  >dispalying a new HTML file.
  >
  >My doubt is How to display a HTML file from a IF loop in a PERL file.

  >
  >
  >From
  >Srinivasan

Reply via email to