I have mod_perl 2.1 installed with Apache 2.5.3.
In a library called, standard.pm, I have a sub routine
sub GetCookies{
undef(%Cookies);
undef(@ReturnCookies);
shift;
@ReturnCookies = @_;
$cookie_flag = 0;
if ($ENV{'HTTP_COOKIE'}) {
if ($ReturnCookies[0] ne '') {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
foreach $ReturnCookie (@ReturnCookies) {
if ($ReturnCookie eq $cookie) {
$value=~s~%20~ ~g;
$Cookies{$cookie} = $value;
$cookie_flag = "1";
}
}
}
}
else {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
$value=~s~%20~ ~g;
$Cookies{$cookie} = $value;
}
$cookie_flag = 1;
}
}
return %Cookies;
}
In my mod_perl file I call the subroutine and ask for the cookies.
#!/usr/bin/perl
use lib::standard;
$standardLibrary=lib::standard;
undef(%Cookies);
%Cookies=$standardLibrary->GetCookies("user");
$user=$Cookies{"user"};
print $user;
For whatever reason, this code will grab someone elses cookie and display the information to the wrong person. Not all the time, or even most of the time. Every once in a while.
Can anyone see anything that could possibly be wrong?
This problem has caused a lot of problems, and I thought I had fixed it until this morning when I got a call from an angry customer with someone elses info on their screen. Obviously they are concerned about their info on someone elses screen as well.
It's impossible to tell how many times this has happend because lots of users don't call.
Thank you,
Tony
In a library called, standard.pm, I have a sub routine
sub GetCookies{
undef(%Cookies);
undef(@ReturnCookies);
shift;
@ReturnCookies = @_;
$cookie_flag = 0;
if ($ENV{'HTTP_COOKIE'}) {
if ($ReturnCookies[0] ne '') {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
foreach $ReturnCookie (@ReturnCookies) {
if ($ReturnCookie eq $cookie) {
$value=~s~%20~ ~g;
$Cookies{$cookie} = $value;
$cookie_flag = "1";
}
}
}
}
else {
foreach (split(/; /,$ENV{'HTTP_COOKIE'})) {
($cookie,$value) = split(/=/);
foreach $char (@Cookie_Decode_Chars) {
$cookie =~ s/$char/$Cookie_Decode_Chars{$char}/g;
$value =~ s/$char/$Cookie_Decode_Chars{$char}/g;
}
$value=~s~%20~ ~g;
$Cookies{$cookie} = $value;
}
$cookie_flag = 1;
}
}
return %Cookies;
}
In my mod_perl file I call the subroutine and ask for the cookies.
#!/usr/bin/perl
use lib::standard;
$standardLibrary=lib::standard;
undef(%Cookies);
%Cookies=$standardLibrary->GetCookies("user");
$user=$Cookies{"user"};
print $user;
For whatever reason, this code will grab someone elses cookie and display the information to the wrong person. Not all the time, or even most of the time. Every once in a while.
Can anyone see anything that could possibly be wrong?
This problem has caused a lot of problems, and I thought I had fixed it until this morning when I got a call from an angry customer with someone elses info on their screen. Obviously they are concerned about their info on someone elses screen as well.
It's impossible to tell how many times this has happend because lots of users don't call.
Thank you,
Tony