session colours

Ask about a PHP problem here.
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: session colours

Post 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.
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: session colours

Post by jacek »

You could have it so that when they log out the entire session is no destroyed, just the user info ?
Image
ashwood
Posts: 144
Joined: Thu May 12, 2011 7:17 am

Re: session colours

Post 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?
I would put a signature.. BUT, i don't have the time.
User avatar
EcazS
Posts: 789
Joined: Fri May 06, 2011 5:29 pm

Re: session colours

Post 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
ashwood
Posts: 144
Joined: Thu May 12, 2011 7:17 am

Re: session colours

Post 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
I would put a signature.. BUT, i don't have the time.
Post Reply