Current location: Hot Scripts Forums » Programming Languages » Perl » Perl + IE + Cookies Problem


Perl + IE + Cookies Problem

Reply
  #1 (permalink)  
Old 12-06-04, 09:08 AM
jebusCL jebusCL is offline
New Member
 
Join Date: Dec 2004
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Perl + IE + Cookies Problem

Hi,

i'm writing an script that need to register three cookies at the same time from three differents servers located under the same domain. the code that i made works perfectly in Mozilla, but under IE i have the problem that the cookies are overwritten, wich means that only one cookie remains in the client and is the last that i sent. plus, i can't read the cookie written.
the script is not CGI

the code that i'm using is like this


sub setCookie
{
my ($expires, @cookies) = @_;
my ($header);
my ($cookie,$value, $char);

my @cookie_encode_chars = ('\%', '\+', '\;', '\,', '\=', '\&', '\:\:', '\s');
my %cookie_encode_chars = ('\%','%25','\+','%2B','\;','%3B','\,','%2C','\=', '%3D','\&','%26','\:\:','%3A%3A','\s','+');
my @cookie_decode_chars = ('\+', '\%3A\%3A', '\%26', '\%3D', '\%2C', '\%3B', '\%2B', '\%25');
my %cookie_decode_chars = ('\+',' ','\%3A\%3A', '::','\%26','&','\%3D','=','\%2C', ',','\%3B',';','\%2B','+','\%25','%');

while(($cookie,$value)=@cookies) {
foreach $char (@cookie_encode_chars) {
$cookie =~ s/$char/$cookie_encode_chars{$char}/g;
$value=~ s/$char/$cookie_encode_chars{$char}/g;
}
if ( $expires)
{
$header.= "Set-Cookie: $cookie=$value; expires = $expires; path=/;\n";
}
shift(@cookies);
shift(@cookies);
}
$cookie =1;
return $header;
}


sub GetCook
{
my (@cookies, %cookie_hash, $cookie, $key, $val);

@cookies = split (/; /,$ENV{'HTTP_COOKIE'});

foreach $cookie (@cookies)
{
($key, $val) = split (/=/,$cookie);
$cookie_hash{$key} = $val;
}
return keys(%cookie_hash);
}


where could be the problem??

thanks in advance
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 12-08-04, 01:31 PM
Chas Chas is offline
Coding Addict
 
Join Date: Oct 2003
Location: California
Posts: 359
Thanks: 0
Thanked 0 Times in 0 Posts
What do you mean by this?

Quote:
the script is not CGI
Is there any reason you are not using CGI.pm to read the cookies?

http://search.cpan.org/~lds/CGI.pm-3...m#HTTP_COOKIES

~Charlie
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
perl newbie has a problem... fowler23 Perl 4 03-24-10 06:14 PM
Problem with PHP cookies robii1 PHP 4 05-18-04 05:00 PM
Setting COOKIES problem.... ArksI PHP 4 04-05-04 04:00 AM
PERL PROBLEM (with listing numbers) web4d Perl 1 11-17-03 10:42 AM
problem in cookies @ phppro list vb2vb PHP 13 06-22-03 09:04 PM


All times are GMT -5. The time now is 06:33 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.