Welcome!

My name is Manmohanjit Singh and I’m 15 this year. Sorry you’ll just have to accept it, I may be a kid to you but trust me I’m not. I live in Malaysia and I go to school at SMK USJ 12. Read more...

Twitter

  • Loading...

@manmohanjit

Recent Tracks

  • Loading...

manmohanjit1

# PHP based Style Switcher with Cookies

by Manmohanjit Singh on Feb 16th, 2010 in Code, Tutorial.

I’ve came across many ’style-changers’, most of them either use Javascript or PHP to set the cookie, but this time I’ll use PHP. Its much more beneficial to do so because if I had used Javascript, browsers that don’t support Javascript will be left out.

This is a very basic, simple and easy to use style changer. I tried to simplify the codes as much as possible.

So unlike last time where I just handed out the links, this time I’ve included many notes in each file. Basically this style-changer consists of two file, index.php and switcher.php. switcher.php is used to set the cookie and redirect the user back from where he/she came where as index.php is a dummy page with a basic style, once you click on a link on the top right of the index.php page. It will change the style using the $_GET method. The server will then set a cookie so that when ever you visit that particular site, the style will be what you picked earlier unless you clear all your cookies.

Demo Download

Tags:

No comments

  • No comments yet...

Leave A Comment

I'm watching you, please be nice and try not to spam. Comments are moderated. You can paste links directly, it will be formatted automatically. Basic XHTML tags are allowed.

Oh, I almost forgot. Comments are powered by Ajax, so don't hit the submit button twice. Thanks!

Wait for 15 seconds...