Hi,
I have a CGI cookie domain question for you all.
I have 2 websites, my main site is http://www.mysite.com/ and my new site is http://www.newmysite.com. However newmysite.com is actually hosted at http://www.mysite.com/newmysite/. I have just asked my domain registar to forward to this new location and put in a frame so that it looks like it's own site, but I dont have to buy more dedicated webspace.
On my new website I have a log in page that lets people log into the website, however the domain cookie thing is giving me problems. If I look at the site from:
http://www.mysite.com/newmysite/ and have cookie dropping code that looks like this:
sub dropCookie { my ($username,$form)=@_; my $sessionID = md5_hex(md5_hex(time.{}.rand().$$)); my $value = "$sessionID\.$username"; my $cookie = $form->cookie(-name=>'sessionID', -value => $value, -path=>'/', -domain=>'.mysite.com'); print $form->header(-cookie=>$cookie) or &dieNice("Failed to put coo +kie on users computer"); return; }
It works fine, but I can't login when I go to www.mynewsite.com. I think this is because the domain is specified at .mysite.com as opposed to .newmysite.com. But it still doesn't work when I change the code to domain=>'.newmysite.com'.
I hope that all makes sense to everyone, it's not really that complicated, but I'm not sure I've explained it too well
Many thanks,
Tom
In reply to Having a cookie domain by CodeJunkie
| For: | Use: | ||
| & | & | ||
| < | < | ||
| > | > | ||
| [ | [ | ||
| ] | ] |