Advertisement
Guest User

Untitled

a guest
Apr 17th, 2014
53
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.99 KB | None | 0 0
  1. // styleswitch.php
  2. $style = $_GET['style'];
  3.  
  4. if(!is_numeric($style)) {
  5. die();
  6. }
  7.  
  8. $value = null;
  9. switch($style) {
  10. case '1':
  11. $value = "default.css";
  12. break;
  13. case '2':
  14. $value = "darksky.css";
  15. break;
  16. case '3':
  17. $value = "halext.css";
  18. break;
  19. case '4':
  20. $value = "flashii.css";
  21. break;
  22. case '5':
  23. $value = "zeniea.css";
  24. break;
  25. default:
  26. $value = "default.css";
  27. break;
  28. }
  29.  
  30. setcookie("blogStyle", $value, time() + 315569260);
  31. header('Location: ' . $_SERVER['HTTP_REFERER']);
  32.  
  33. // This goes in the webpage
  34. <link rel="stylesheet" type="text/css" href="css/<?php if(!isset($_COOKIE["blogStyle"])) { echo 'default.css'; } else { echo $_COOKIE['blogStyle']; } ?>" />
  35.  
  36. <li>Style Switcher: </li>
  37. <li><a href="styleswitch.php?style=1">Default</a></li>
  38. <li><a href="styleswitch.php?style=2">Darksky</a></li>
  39. <li><a href="styleswitch.php?style=3">Halext</a></li>
  40. <li><a href="styleswitch.php?style=4">Flashii</a></li>
  41. <li><a href="styleswitch.php?style=5">Zeniea</a></li>
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement