J
Jason
Well, it was bound to happen. I've gotten myself into a bind. I have a
pretty high-traffic site, and my old host simply couldn't handle it, so
I'm moving parts of the site to a different host. Sloppy, I know, but
this is a band-aid until I can set up a dedicated.
Anywho, here's my problem. When my visitor logs in, a cookie is set
that the rest of the site recognized to give them options and features.
But with a portion of the site on a different server entirely (and a
different domain), the cookie isn't recognized by the other domain.
Here's where it gets fun. Because of the way everything is written, the
login function is part of a LIB file that is shared by about 40
scripts. So I need to figure out a way to set 2 cookies (one for each
domain), but without using any modules (to do so would require
modifying all 40 scripts), without using pop-up windows (I can't create
a window in the middle of the process), and without using image tags to
call outside scripts.
I tried using the "domain" attribute when setting the cookie, but
that's not doing what I need. I've never used that attribute before, so
I really don't know if I'm using it correctly, nor do I really
understand its purpose.
Here is the the bit that I've been using up until now:
print "Set-Cookie: user=$username; path=/; expires=$expires\n";
sleep (1); # for some reason, the cookie wouldn't work immediately
unless I use sleep
I tried this modification, but to no avail:
print "Set-Cookie: user=$username; domain=.$domain_one; path=/;
expires=$_[2]\n";
sleep (1);
print "Set-Cookie: user=$username; domain=.$domain_two; path=/;
expires=$_[2]\n";
sleep (1);
Both work fine on the domain that sets the cookie, but not on the other
domain.
Is there any way to set a cookie for more than one domain, or am I just
dreaming?
TIA,
Jason
pretty high-traffic site, and my old host simply couldn't handle it, so
I'm moving parts of the site to a different host. Sloppy, I know, but
this is a band-aid until I can set up a dedicated.
Anywho, here's my problem. When my visitor logs in, a cookie is set
that the rest of the site recognized to give them options and features.
But with a portion of the site on a different server entirely (and a
different domain), the cookie isn't recognized by the other domain.
Here's where it gets fun. Because of the way everything is written, the
login function is part of a LIB file that is shared by about 40
scripts. So I need to figure out a way to set 2 cookies (one for each
domain), but without using any modules (to do so would require
modifying all 40 scripts), without using pop-up windows (I can't create
a window in the middle of the process), and without using image tags to
call outside scripts.
I tried using the "domain" attribute when setting the cookie, but
that's not doing what I need. I've never used that attribute before, so
I really don't know if I'm using it correctly, nor do I really
understand its purpose.
Here is the the bit that I've been using up until now:
print "Set-Cookie: user=$username; path=/; expires=$expires\n";
sleep (1); # for some reason, the cookie wouldn't work immediately
unless I use sleep
I tried this modification, but to no avail:
print "Set-Cookie: user=$username; domain=.$domain_one; path=/;
expires=$_[2]\n";
sleep (1);
print "Set-Cookie: user=$username; domain=.$domain_two; path=/;
expires=$_[2]\n";
sleep (1);
Both work fine on the domain that sets the cookie, but not on the other
domain.
Is there any way to set a cookie for more than one domain, or am I just
dreaming?
TIA,
Jason