Hi Monks,
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
}