Jump to content

Language selection problem


Beppis

Recommended Posts

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");
}

?>

Link to comment
https://forums.phpfreaks.com/topic/210669-language-selection-problem/
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.