the_slycer has asked for the wisdom of the Perl Monks concerning the following question:
and to retrieve the information:sub set_cookie { ########################################### # Create a cookie. We have a few different # "states" and all of them require at least # *some* user information # Uses a global CGI object ($p) to create # the cookie ########################################### # Get the passed user information my %ui = @_; # set the params for the cookie my $cookie = $p->cookie( -name => 'mycookie', -value => qq(Name:$ui{'Name'}:Phone:$ui{'Phone'}:EmployeeNum:$ui{'Em +ployeeNum'}:Email:$ui{'Email'}:SapId:$ui{'SapId'}:NTID:$ui{'NTID'}:Pr +ovince:$ui{'Province'}), -expire => '', ); # send it to the browser print $p->header(-cookie => $cookie); }
As mentioned above, this works great using apache, fails miserably using IIS (though everything else in the script runs fine).sub get_cookie { ################################################ #Retrieve the cookie #Uses a global variable ($p) for the CGI object #Returns user information ################################################ my %userinf; if ($p->cookie('mycookie')) { my $values = $p->cookie('mycookie'); %userinf = split /:/,$values; } else { display_login(); #No cookie, force a login } print $p->header(); return (%userinf); }
|
---|
Replies are listed 'Best First'. | |
---|---|
Re: Cookies on Apache vs cookies on IIS
by dws (Chancellor) on Mar 15, 2002 at 22:21 UTC | |
by the_slycer (Chaplain) on Mar 16, 2002 at 01:54 UTC | |
Re: Cookies on Apache vs cookies on IIS
by the_slycer (Chaplain) on Mar 15, 2002 at 19:31 UTC | |
by Hero Zzyzzx (Curate) on Mar 15, 2002 at 20:45 UTC | |
Re: Cookies on Apache vs cookies on IIS
by the_slycer (Chaplain) on Mar 18, 2002 at 19:42 UTC |