Actually, this is the code for Validate.pl.  Validate looks up the username
and password, and if it's not found, gives the user the chance to hit the
Back button and re-enter.  On Continue, it sets the name of the menu to
load, and goes forward to StargPage.pl, wihch simply sets up a frames page
with the appropriate menu in the left frame.

StartPage.pl DOES INDEED receive $nextnav.  If I set up a simple form to
create the hidden field and call StartPage.pl, it  works: but, when it's
done from Validate.pl, it re-enters Validate.pl instead of calling
StartPage.pl.  Most odd.

Also, this is just the prototype of the finished product.  It DOES need to
be a form, eventually.   Eventually, there will be one-way encryption on the
password, and it will be compared to a stored, encrypted password.  So, what
I neeed is a way to validate the pairs, give the user a choice of going back
or going forward, and passing the appropriate menu name to the next program.

Any thoughts, anyone?

> -----Original Message-----
> From: Howdy! [mailto:[EMAIL PROTECTED]]
> Sent: Saturday, June 09, 2001 11:11 AM
> To: Kris Cook
> Subject: Re: Circular reference
> 
> 
> << Regarding: Circular reference, Kris Cook said >>
> 
> 
> > I wrote a Perl script that receives a trio of parameters 
> (DSN, user ID and
> > password), and validates that the UserID and Passwd match a 
> pair in the
> > database.  It then displays a message based on whether you 
> validated, and
> > gves you a continue button.  This seems to work fine, but 
> when you click
> on
> > continue, instead of going to the next page, it re-enters 
> the same Perl
> > script!  Of course, this time it hasn't prepared the 
> parameters, so now it
> > DOESN'T find the right information.  I am extremely confused.
> >
> > The code is below:
> 
> << Snipped Code  >>
> 
> > my $cgi        = new CGI;
> > my $dsn        = $cgi->param('DSN');
> > my $ODBCString = "DSN=".$dsn.";";
> > print "Content-type: text/html\n\n";
> >
> > my $userid     = $cgi->param('userid');
> > my $passwd     = $cgi->param('passwd');
> 
> << Snipped Code  >>
> 
> > if ($db->FetchRow) {
> >    my %Data;
> >    undef %Data;
> >    %Data = $db->DataHash();
> >    my $found;
> >    my $item;
> >    my $value;
> >    while (($item,$value) = each(%Data))
> >    {
> >       $found = $value;
> >    }
> >    if ($found)
> >    {
> >       $welcome = "Welcome ".$userid."!  Good to seeya!  
> Click Continue to
> go
> > on.";
> >       $nextnav = "AdminMenu.htm";
> >    }
> >    else
> >    {
> >       $welcome = "Sorry, ".$userid.", but I don\'t find a matching
> > password.<BR>\n".
> >                  "I\'ll have to send you in as a user, or 
> you can click on
> > your browser\'s<BR>\n".
> >                  "<STRONG>Back</STRONG> button and try again.<BR>";
> >       $nextnav = "VisitorMenu.htm";
> >    }
> > }
> > print <<EOF;
> >          <BR>
> >          $welcome
> >          <FORM ACTON="http://localhost/scripts/StartPage.pl";>
> >          <INPUT TYPE="hidden" NAME="nextnav" VALUE="$nextnav">
> >          <P>
> >          <INPUT TYPE="submit" VALUE="Continue">
> >       </FORM>
> >    </BODY>
> > </HTML>
> > EOF
> 
> The ACTION part of your FORM tag is telling it to go to 
> StartPage.pl which I
> assume is the code you've included.  You have $nextnav tucked 
> into a hidden
> form field for which StartPage.pl is not using.
> 
> It looks like you don't need a form here at all.  Either make 
> a hyperlink
> for the
> 'Continue' with the right $nextnav like:  <a 
> href=$nextnav>Continue</a> OR
> use a button with javascript to go to the right page like:
> <INPUT TYPE=BUTTON VALUE='Continue'
> ONCLICK="Javascript:document.location.href='$nextnav' "> OR
> Cgi.pm style: print
> $cgi->button(-name=>'Continue',-onClick=>"Javascript:document.
> location.href=
> '$nextnav' ");
> 
> Hope that helps!
> 
> Joel
> 
> 

Reply via email to