From: Jason Carlton on
This script worked through earlier versions of both IE and FF, but the
newer versions aren't writing the cookie if $remember=1. If
$remember=0 then the cookie is set correctly, so I'm pretty sure that
the error is with the $expires variable. I'm guessing that there's a
typo that the older versions didn't recognize.

Are there supposed to be hyphens in the $expires date? If so, then do
you see any other reason that $expires would be causing a problem?

In this script, $remember is determined by a standard checkbox.

TIA,

Jason


# Log In Script
my $expires;

if ($remember) { $expires = "Sun, 04-Jan-2015 00:00:00 GMT"; }
($found, $banned) = log_in($username, $password, $expires);

sub log_in {

# snip irrelevant authorization info

print "Set-Cookie: user=$userID; path=/; expires=$_[2]\n";
return $found, $banned;
}
From: QoS on

Jason Carlton <jwcarlton(a)gmail.com> wrote in message-id: <f4ed5d14-d1d6-4e41-8c81-4663fe87be7f(a)j9g2000vbp.googlegroups.com>

>
> This script worked through earlier versions of both IE and FF, but the
> newer versions aren't writing the cookie if $remember=1. If
> $remember=0 then the cookie is set correctly, so I'm pretty sure that
> the error is with the $expires variable. I'm guessing that there's a
> typo that the older versions didn't recognize.
>
> Are there supposed to be hyphens in the $expires date? If so, then do
> you see any other reason that $expires would be causing a problem?
>
> In this script, $remember is determined by a standard checkbox.
>
> TIA,
>
> Jason
>
>
> # Log In Script
> my $expires;
>
> if ($remember) { $expires = "Sun, 04-Jan-2015 00:00:00 GMT"; }
> ($found, $banned) = log_in($username, $password, $expires);
>
> sub log_in {
>
> # snip irrelevant authorization info
>
> print "Set-Cookie: user=$userID; path=/; expires=$_[2]\n";
> return $found, $banned;
> }

My guess is @_ is being overwrittin by the time you use it.
It is always a good idea to save away your sub's startup parameters right away.

sub someSub {
my $expires = $_[2] || 'DEFAULT VALUE OR ACTION';
}

In this case, since $expires is accessible by sub log_in(), you might
try changing the print line to something like:

if (! $expires) {
#remember was not checked, use default 'expires' value
$expires = 'DEFAULT';
}
print "Set-Cookie: user=$userID; path=/; expires=$expires\n";

hth,
J




 | 
Pages: 1
Prev: permutations of symbols?
Next: Perl bioinformatics