Hi All,
On a website I use sessions to store a users'prefernce with regards to color specifications. I have two main setups, one green-based and one brown-based.
Upon loading the page, I check for a swap, which works. The menu gets the right link and all for the color swap. And on my local server the new settings are retained. But on the live server, it doesn't! It will load the new color, but will not retain it to the next page.
When I chect the session array, it resets the value:
First page with new color:
Array
(
[name] => jelle4
[colorscheme] => b
)
The second load:
Array
(
[name] => jelle4
[colorscheme] =>
)
What am I missing?
Local machine: PHP Version 4.2.3, reg.glob off
Live machine: PHP Version 4.3.10, reg.glob off
The check / set routine:
$colorscheme = getvar('c', '', 2);
if($_GET[c] == "")
{
$colorscheme = $_SESSION[colorscheme];
}
else
{
$_SESSION[colorscheme] = $colorscheme;
}
switch($colorscheme)
{
default:
$barurl = $baseurl."layout/gif/groen/";
$stylesheet = $baseurl."layout/colors_m_g.css";
$menuswap="<a class=\"menu0\" href=\"$_SERVER[PHP_SELF]?c=b\">Swap colors</a>";
break;
case 'g':
$barurl = $baseurl."layout/gif/groen/";
$stylesheet = $baseurl."layout/colors_m_g.css";
$menuswap="<a class=\"menu0\" href=\"$_SERVER[PHP_SELF]?c=b\">Swap colors</a>";
break;
case 'b':
$barurl = $baseurl."layout/gif/bruin/";
$stylesheet = $baseurl."layout/colors_m_b.css";
$menuswap="<a class=\"menu0\" href=\"$_SERVER[PHP_SELF]?c=g\">Swap colors</a>";
break;
}
?>