I'm using a very simple Stylesheet Switch by php. It was fine all along but days ago I turn on Caching mode and now it only work for login user. If turn off Caching mode, it will work again for both user.
Basically the code looks like this
In the page.php header
<?php
if(isset($_COOKIE['style'])){
$style=$_COOKIE['style'];
} else {
$style='green';
}
?>
<link type="text/css" rel="stylesheet" href="/css/<?php echo $style ?>.css">
It switch by
<a href="http://www.mydomain.com/switch.php?style=blue">Blue</a>
In the switch.php
<?php setcookie('style', $_GET['style'], time()+31536000);
header('Location:'.$HTTP_SERVER_VARS['HTTP_REFERER']);
?>
I did many research but couldn't find the right way. Please help if you can. Thank you