
Originally Posted by
bo5ton
I'm not sure how do to this. Can you provide any links for guidance? Would this set a theme via their IP or something?
Thanks.
It would link the theme to their session id. This means that aslong as their browser is open you can see what theme they selected during that browser session. For example. If i go to your site and select a theme. Then go to google.com and later to sitepoint.com and then return to your site I still get to see the same theme. However. Once I close my browser the information disappears. Sessions are stored on the server instead of the users pc.
Working with sessions in php is very easy. The most important thing is that you must remember to start each script in which you want to use the session with:
PHP Code:
session_start();
http://php.net/manual/en/function.session-start.php
Once you do that you can simply use the $_SESSION variable to store data:
PHP Code:
$_SESSION['my_theme'] = 'theme_id';
Checking to see if the session exists is also straight forward:
PHP Code:
if(isset($_SESSION['my_theme'])){
// session exists
echo $_SESSION['my_theme'];
}
Bookmarks