PHP DoubleEcho with IP check for bilingual web suddenly stopped working
<p>Good day,</p>

<p>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!</p>

<p>Tony S.</p>

<pre><code>&lt;?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;
}
?&gt;
&lt;!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
        "http://www.w3.org/TR/2000/REC-xhtml1-20000126/DTD/xhtml1-strict.dtd"&gt;
&lt;html xmlns="http://www.w3.org/1999/xhtml" xml:lang="&lt;?php echo $lang; ?&gt;" lang="&lt;?php echo $lang; ?&gt;"&gt;
 &lt;head&gt;
  &lt;meta http-equiv="content-type" content="text/html; charset=utf-8" /&gt;
  &lt;meta http-equiv="Content-language" content="&lt;?php echo $lang; ?&gt;" /&gt;    
</code></pre>
