htmanning has asked for the wisdom of the Perl Monks concerning the following question:
I'm writing a little script to read a phpbb cookie from pages outside the forum. If the person is logged in, I print one thing, if they're not logged in I print another.
This worked when I only ran it on one site, but now it's getting confused. I have several domains running the same kind of forums, and I'm running this script on each domain. All of a sudden the script doesn't know whether it's logged in or not. It's as if it is reading a cookie from another domain. Is that possible? Shouldn't this code tell it to read the cookie on the domain it's called from?
local(@getcookies) = split (/; /,$ENV{'HTTP_COOKIE'}); local(%cookies); foreach(@getcookies){ ($ckey, $cval) = split (/=/,$_); $cookies{$ckey} = $cval; } $user_logged = $cookies{'phpbb2mysql_data'}; $user_sid = $cookies{'phpbb2mysql_sid'}; if ($user_logged !~ /autologinid/) { print <<HTML; <a NOCOLOR NOUNDERLINE id="top3" href="/forums/login.php?" target=_top +><SPAN STYLE="COLOR: #0033cc">Log in</span></a> HTML } else { print <<HTML; <SPAN STYLE="COLOR: #0033cc" id="top3" >Welcome back! | <a NOCOLOR NOU +NDERLINE id="top3" href="/forums/login.php?logout=true&sid=$user_sid" + target=_top>Log out</a></span> HTML }
|
|---|
| Replies are listed 'Best First'. | |
|---|---|
|
Re: Help reading cookies
by eye (Chaplain) on Nov 23, 2008 at 08:15 UTC | |
by htmanning (Friar) on Nov 23, 2008 at 08:49 UTC | |
by skx (Parson) on Nov 23, 2008 at 15:05 UTC | |
by htmanning (Friar) on Nov 23, 2008 at 21:14 UTC | |
|
Re: Help reading cookies
by fmerges (Chaplain) on Nov 23, 2008 at 13:52 UTC | |
|
Re: Help reading cookies
by Anonymous Monk on Nov 23, 2008 at 07:54 UTC |