I have a problem whit my script in my pages. I have a multiple language ( French / English) in my page.
I call this tag in my index.php.
<?php
require("../shared/lang/incl-lang.php")
?>
And in my page incl-lang.php i have this code.
<?php
if(isset($HTTP_COOKIE_VARS['lang'])) {
$lang = $HTTP_COOKIE_VARS['lang'];
} else {
$lang = substr($HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'],0,2);
}
if ($lang=='fr') {
include('../shared/lang/fr-lang.php');
} else if ($lang=='en') {
include('../shared/lang/en-lang.php');
}
$expire = 365*24*3600;
setcookie("lang",$lang,time()+$expire);
?>
The problem is when the cookie is written i'am not able to change my language whit the url.
http://mysite.com/index.php?lang=en
or
http://mysite.com/index.php?lang=fr
Because the code take my cookie value before.
If someone see my error or know another way to make this php project work please tell me.