Posted By

mzym on 09/22/09


Tagged

javascript cookies language


Versions (?)

Who likes this?

1 person have marked this snippet as a favorite

vali29


Language Switch


 / Published in: PHP
 

  1. if ($_GET['setlan']) {
  2. setcookie ('lang',$_GET['setlan'], time()+60*60*24*7*2,"/",".url.com",0);
  3. $slang = $_GET['setlan'];
  4.  
  5. if ($_GET['setlan'] == "de") {
  6. echo"<script language=\"JavaScript\">
  7. function reDirect() {
  8. self.location.href = \"/de/?$slang\";
  9. }
  10. reDirect();
  11. </script>";
  12. } else {
  13. echo"<script language=\"JavaScript\">
  14. function reDirect() {
  15. self.location.href = \"/en/?$slang\";
  16. }
  17. reDirect();
  18. </script>";
  19. }
  20. }
  21.  
  22. $slang = htmlentities($_COOKIE['lang']);
  23.  
  24.  
  25. if (!$slang) {
  26. $slang = "de";
  27. }

Report this snippet  

You need to login to post a comment.