I've placed some simple cookie handling code in a site to keep track of the last site visited between 2 choices on the main site. Here's the code in the header of the main site to check and change the cookie when the site changes. Thanks for any insights. ;-)
if($_REQUEST['site'] == 'sitea'){
setcookie('location', 'sitea',time()+60*60*24*365);
header("Location: http://www.sitea.com");
exit;
}
if($_REQUEST['site'] == 'siteb'){
setcookie('location', 'siteb',time()+60*60*24*365);
header("Location: http://www.siteb.com");
exit;
}
if(isset($_COOKIE['location'])) {
if($_COOKIE['location'] == 'sitea') {
header("Location: http://www.sitea.com");
exit;
}
if($_COOKIE['location'] == 'siteb') {
header("Location: http://www.siteb.com");
exit;
}
}
This code seems to work in FF and Chrome as far as I can tell. Then again, it seems to work on my own computer with IE8 but does not on anyone else's computers I've asked to check it out on.