Programming Forums
User Name Password Register
 

RSS Feed
FORUM INDEX | TODAY'S POSTS | UNANSWERED THREADS | ADVANCED SEARCH

Reply
 
Thread Tools Display Modes
Old Dec 6th, 2004, 8:18 AM   #1
jebusCL
Newbie
 
Join Date: Dec 2004
Posts: 1
Rep Power: 0 jebusCL is on a distinguished road
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 :huh:
jebusCL is offline   Reply With Quote
Reply

Bookmarks

« Previous Thread in Forum | Next Thread in Forum »

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 On
HTML code is Off
Forum Jump




DaniWeb IT Discussion Community
All times are GMT -5. The time now is 6:35 PM.

Powered by vBulletin® Version 3.7.0, Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Copyright ©2007 DaniWeb® LLC