sub gotoMainScreen()
{
  print "<meta http-equiv=\"refresh\" content=\"1; 
url=yourmainscreen.pl\">";
}
# 
=============================================================================



----Original Message Follows----
From: Rhen Hernandez <[EMAIL PROTECTED]>
To: <[EMAIL PROTECTED]>
Subject: Username & Password Question
Date: Wed, 3 Jul 2002 08:30:35 -0700

hi everyone!

I created a password and username for my website.  My question is how can i 
direct the user to the homepage or main page of the website.  Right now, the 
code is set for "Permission Granted..."  I want to direct the user to the 
main page of the website after he/she is successful completed the form.

Thank you...
rhen

here's my code:

#!/usr/bin/perl

use CGI qw/:standard/;

my $username = param(USERNAME);
my $password = param(PASSWORD);

open(FILE, "data.txt") ||
    die "The database could not be opened";

    while(<FILE>)
    {
       @data = split(/\n/);

       foreach $entry (@data)
       {
          ($name, $pass) = split(/,/, $entry);

          if($name eq "$username")
          {
             $userverified = 1;
             if ($pass eq "$password")
             {
                $passwordverified = 1;
             }
          }
        }
    }

    close(FILE);

    if ($userverified && $passwordverified)
    {
       &accessgranted;
    }
    elsif ($userverified && !$passwordverified)
    {
       &wrongpassword;
    }
    else
    {
       &accessdenied;
    }

sub accessgranted
{
    print header;
    print "<TITLE>Thank You</TITLE>";
    print "<FONT FACE = Arial SIZE = 2 COLOR = BLUE>";
    print "<STRONG>Permission has been granted $username.";
    print "<BR> Enjoy the site.</STRONG></FONT>";

}

sub wrongpassword
{
    print header;
    print "<TITLE>Access Denied</TITLE>";
    print "<FONT FACE=Arial SIZE=2 COLOR=Red><STRONG>";
    print "You entered an invalid password.<br> ";
    print "Access has been denied.</STRONG></FONT>";
    exit;

}

sub accessdenied
{
    print header;
    print "<TITLE>Access Denied</TITLE>";
    print "<FONT FACE=Arial SIZE=3 COLOR=Red><STRONG>";
    print "You were denied access to this server.";
    print "</STRONG></FONT>";
    exit;
}



--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]





_________________________________________________________________
Send and receive Hotmail on your mobile device: http://mobile.msn.com


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to