If not, did you set the cookie to only be readable by that page?
I'm not sure this is possible...if so, it's something I've never heard of. Please explain...
Are you setting the cookie on one domain but trying to retrieve it on another? For example, if you set the cookie on domain.com but link to other pages under www.domain.com, then the cookies won't be available by default.
The cookie is set on one page and retrieved on any subsequent pages the user visits after their session expires (the cookie value holds the name of a custom stylesheet).
For example:
1. The user selects a custom theme (the cookie is set as well as a session
variable).
2. The user leaves the website and comes back (the cookie is retrieved once and stored in a session variable).
The file that handles the setting and retrieving is included at the top of every page:
session.php
<?php
// Start/continue session
session_start();
header("Cache-control: private"); //IE 6 Fix
// Change theme if told to do so
if( isset($_GET['style']) ) {
$_SESSION['screen-style'] = $_GET['style'];
// Remember for next visit
setcookie('screen-style', $_GET['style'], time()+60*60*24*30);
}
// Try to retrieve style from cookie, if not currently stored in $_SESSION
if( !isset($_SESSION['screen-style']) && isset($_COOKIE['screen-style']) ) $_SESSION['screen-style'] = $_COOKIE['screen-style'];
// No style specified, use default
if( empty($_SESSION['screen-style']) ) $_SESSION['screen-style'] = "screen.css";
?>
I just thought of something...could it be because I am trying to retrieve the cookie and store it in $_SESSION from within an included file?
Not sure offhand if that will make a difference. I'll test it out tomorrow...
aksival