Beppis Posted August 13, 2010 Share Posted August 13, 2010 When you select language I just got an error message Got an error message that says: This problem can sometimes occur if you are disabled or refused to take accept cookies. I have accepted cookies. My code is: language.php <?php if(!isset($_COOKIE['language'])) { if(!isset($_GET['lang'])) { ?> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>123</title> <style type="text/css"> <!-- body { background-image: url(images/background.jpg); } .style1 { color: #FFFFFF; font-weight: bold; } --> </style></head> <body> <p><br> <br> <br> <br> <br> </p> <div align="center" style="margin-top:400px;"> <table width="200" border="0"> <tr> <td width="114"><div align="left"><a href="language.php?lang=swe"><img src="http://www.clickbuxer.com/images/swe.jpg" border="0" alt="swedish" /></a></div></td> <td width="1" rowspan="2"> </td> <td rowspan="2"><div align="left"></div></td> <td><a href="language.php?lang=usa"><img src="http://www.clickbuxer.com/images/usa.jpg" border="0" alt="usa" /></a></td> </tr> <tr> <td> </td> <td> </td> </tr> <tr> <td><div align="center" class="style1">SWE</div></td> <td> </td> <td width="0"><div align="center"></div></td> <td width="110"><div align="center" class="style1">USA</div></td> </tr> </table> </div> <p align="center"> </p> </body> </html> <?php } else { //Add cookie code $language = $_GET['lang']; setcookie("language", $language, time()+3600);//set to expire in 1 hour, 3600=seconds switch($language) { case usa: $redirect = "http://www.clickbuxer.com"; break; case swe: $redirect = "http://www.clickbuxer.com/sv/index.php"; break; default: $redirect = "http://www.clickbuxer.com"; } header("Location: $redirect"); } } else { //If cookie is already set $language = $_COOKIE['language']; switch($language) { case usa: $redirect = "http://www.clickbuxer.com"; break; case swe: $redirect = "http://www.clickbuxer.com/sv/index.php"; break; default: $redirect = "http://www.clickbuxer.com"; } header("Location: $redirect"); } ?> index.php <?php if(!isset($_COOKIE['language'])) { header("Location: http://www.clickbuxer.com/language.php"); } else { $language = $_COOKIE['language']; switch($language) { case usa: $redirect = "http://www.clickbuxer.com"; break; case swe: $redirect = "http://www.clickbuxer.com/sv/index.php"; break; default: $redirect = "http://www.clickbuxer.com"; } header("Location: $redirect"); } ?> Quote Link to comment Share on other sites More sharing options...
Beppis Posted August 13, 2010 Author Share Posted August 13, 2010 I want the cookie to deside where the visitor is heading. If the user choose swe then it should always be directed to /sv/index.php even if you type www.clickbuxer.com again... Go in and see my error message :'( http://www.clickbuxer.com Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.