This is how I did it.
if ( @loginfo = CGI::cookie('mspplog') ) {
        $user_name = $loginfo[0];
        $password = $loginfo[1];
        $checkPassword = 'true';
}
On Friday 07 February 2003 08:07 am, Kipp, James wrote:
> > All am I am trying to do now is have a user enter his/her
> > name in a form and have that saved to a cookie, so when they
> > return, they will get something like " Your juser, please
> > proceed" . I took the example here:
> > http://stein.cshl.org/WWW/CGI/examples/cookie.cgi
> >
> > Below is the code I am working with.  But when I return to
> > the page I just get the form again. What am i missing. Sorry
> > if this is obvious, but i am not getting it and I have read
> > the tutorial and the RFC on http state (thanks John ).
>
> I revised the code to get rid of the obvious mistakes. I can see that the
> cookie is made, but how can get it to print the user after it reads that
> there is indeed a a cookie.
> here is what i have now:
> ---
> use CGI qw(:standard);
> # get cookie if it is there
> %all = cookie('user');
> # Recover the new users from the form parameter 'new_user'
> $new = param('new_user');
>
> # Add  the user submitted in the form as the new cookie
> $cookie = cookie(-name=>'user',
>                    -value=>$new,
>                    -expires=>'+1h');
>
> # Print the header, incorporating the cookie and the expiration date...
> print header(-cookie=>$cookie);
> # Now we're ready to create our HTML page.
> print start_html('Test cookie');
>
> if (%all) {                   # shouldn't it print if there is a cookie
> found??
>       foreach $key ( keys %all) {
>               print "<p>$all{$key}</p>";
>     }
> }
> else { print "<p> NO USERS SAVED </p>" };
>
> print qq(
> <FORM METHOD=POST>
> User Name:  <INPUT NAME="new_user" TYPE="TEXT">
> <INPUT TYPE="SUBMIT" VALUE="Send">  <INPUT TYPE="RESET">
> </FORM>
> );
>
> print end_html;

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

Reply via email to