Good day,
Sorry to trouble you with that, but i ran out of options already. On my Websites, right at the top of the head section, i have a PHP code that defines (or defined) that if you connect from Czech, or Slovakia (based on IP adress check) you'll get a Czech content, rest IP adresses will get english content. This is done by defining parameters for DoubleEcho function. It worked perfectly, however suddenly it stopped. Basics of the code is alright, I can still switch content manually, but automatic selection somehow crashed. I get english content all the time. Please, i would be really glad, if you can have a look at the code bellow.Thanks a lot in advance!
Tony S.
<?php
// Language - URL check
if(isset($_GET['en']))
$lang = 'en';
elseif (isset($_GET['cz']))
$lang = 'cs';
// Language - IP check
else {
$pc = gethostbyaddr($_SERVER["REMOTE_ADDR"]);
$ext = array_pop(explode('.', $pc));
if($ext == 'cz' OR $ext == 'sk')
$lang = 'cs';
else
$lang = 'en';
}
// Language - Echo function
function DoubleEcho($text_cs, $text_en)
{
global $lang;
if($lang == 'cs')
echo $text_cs;
else
echo $text_en;
}
?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xml:lang="<?php echo $lang; ?>" lang="<?php echo $lang; ?>">
<head>
<meta http-equiv="content-type" content="text/html; charset=utf-8" />
<meta http-equiv="Content-language" content="<?php echo $lang; ?>" />