Page 2 of 2
Re: session colours
Posted: Sun Jun 05, 2011 8:47 pm
by EcazS
ashwood wrote:i was thinking when the user is logged in thats when they will be able to change the style.. when they log out it session_destroy() doesnt only log out but it now kills that style session should i leave it like that you think as the user can only change the style when they are logged in?
You could do it so when they click that link it will check if they're logged in and if they are it will update a row called "style" in your database with the style selected and when they login you grab the row and set the style.
Re: session colours
Posted: Sun Jun 05, 2011 8:54 pm
by jacek
You could have it so that when they log out the entire session is no destroyed, just the user info ?
Re: session colours
Posted: Sun Jun 05, 2011 8:56 pm
by ashwood
jacek wrote:You could have it so that when they log out the entire session is no destroyed, just the user info ?
hmm i dont know the above where that dude (sorry cant see name proper whilst typing..) said store it so when they log in it shows i might do that but at the minute im faced with this..
i have
<?php
if(empty($_SESSION['stylesheet']))
{
$_SESSION['stylesheet']="styles/default/stylesheet.css";
echo "<link href='".$_SESSION['stylesheet']."' rel='stylesheet' type='text/css' />";
}
else
{
echo "";
}
?>
BUT because the session isn't empty when they refresh homepage it echo's nothing so therefore no stylesheet?
Re: session colours
Posted: Sun Jun 05, 2011 8:58 pm
by EcazS
You wanna switch your code around, echo the stylesheet in the else statement. They way you have it now you will echo the stylesheet IF the session is empty
Re: session colours
Posted: Sun Jun 05, 2011 9:00 pm
by ashwood
EcazS wrote:You wanna switch your code around, echo the stylesheet in the else statement. They way you have it now you will echo the stylesheet IF the session is empty
ahh no its because im setting the session there where i need it to stay empty.. ahh 2mins