I have coded a multilingual web with php & mysql. Now I've faced problems (mainly with robots, seo and search engines) because language chooser is based on cookies.
how it works now: user => index.php :
function cookies() {
if (!isset($_COOKIE["lang"])){
setcookie('lang','ukr', time()+(60*60*24*31));
header('Location: index.php');
}};
and outputting chosen language to every place it needed to be with the function:
function catSet($source, $link, $item){
$item .= '_'. $_COOKIE['lang'];
global $connection;
$link = mysqli_real_escape_string($connection, $link);
$result = mysqli_query($connection, "SELECT * FROM $source WHERE link_item = '". $link ."'");
if (!$result) { die("DB Query failed: " . mysql_error()); }
while ($row = mysqli_fetch_array ($result)) {
echo $row[$item]; }}
What I want now is to have $item .= '_'. $_COOKIE['lang'];
to be replaced with constant based on a user choice which would be readable by robots and search engines, so it's a must it's not a cookie.
I don't want to use session, because this way user have to re-choose language each time after session expires.
AFAIK there is no way to detect browsers language, to set it as default.
I see a way out to use [GET] variable instead, and pass it each time to other page, but how to store this [GET] data if user come back next time (same problem as with sessions).
I would appreciate any ideas and solutions :)