Paste Search Dynamic
Recent pastes
set-theme
  1. <?php
  2.  
  3. if(isset($_GET['set-theme'])) {
  4.     $selectedTheme = $_GET['set-theme'];
  5.  
  6.     if($selectedTheme == "white") {
  7.         setcookie("theme", "white", 60*60*24*30);
  8.     }
  9.  
  10.     if($selectedTheme == "black") {
  11.         setcookie("theme", "black", 60*60*24*30);
  12.     }
  13. }
  14.  
  15. $theme = "white";
  16. if(isset($_COOKIE['theme']))
  17.     $theme = $_COOKIE['theme'];
  18.  
  19. echo "Le thème est {$theme}";
  20. ?>
  21.  
  22. <a href="?set-theme=black">Theme black</a>
  23. <a href="?set-theme=white">Theme white</a>
Parsed in 0.012 seconds