Current time: 04-24-2014, 12:45 PM Hello There, Guest! (LoginRegister)

Post Reply 
$HTTP_ACCEPT_LANGUAGE
02-22-2009, 01:23 PM
Post: #1
$HTTP_ACCEPT_LANGUAGE
I added this language based redirect below on my page, yet $HTTP_ACCEPT_LANGUAGE keeps reading the language as English (even after I change the browser language). A friend tossed the same php on a site that was hosted by Yahoo and it worked perfectly. I'm sure I'm missing something dead simple, but I just can't figure out what I'm doing wrong. Any and all help is appreciated.

<?php
$lang=strtok($HTTP_ACCEPT_LANGUAGE,",");
if ($lang == "fr") {
header("Location: /france.htm");
}

?>
Find all posts by this user
Quote this message in a reply
02-22-2009, 02:16 PM
Post: #2
$HTTP_ACCEPT_LANGUAGE
Quote:I'm sure I'm missing something dead simple, but I just can't figure out what I'm doing wrong. Any and all help is appreciated.
Yes. For security reasons DreamHost has "register globals" turned off.

You should be using $_SERVER['HTTP_ACCEPT_LANGUAGE'] instead. See for exampe http://phpinfo.dreamhosters.com/phpinfo.php (scroll all the way down to PHP Variables)

Cool openvein.org -//-
Visit this user's website Find all posts by this user
Quote this message in a reply
02-22-2009, 06:41 PM
Post: #3
$HTTP_ACCEPT_LANGUAGE
Thank you so much. That works perfectly!!!
Find all posts by this user
Quote this message in a reply
Post Reply 


Forum Jump: