Only show for en Language

Now more and more adsense accounts are banned due to useless trafice, especially non-English speaking countries trafic, we can add the following code to test our visiters Computer language:

$_SERVER[‘HTTP_ACCEPT_LANGUAGE’]

<?php
$a = $_SERVER[‘HTTP_ACCEPT_LANGUAGE’];
echo $a;
?>

We can get different results, such as en-US, en-Ca, zh-CH. We can use substr() to get certain numbers we need.

 

<?php
$a = substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2);
echo $a;
?>

If you use wordpress, you can try the following code:

<div>
<?php if (($wp_query->current_post == 0)and ((substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2) == ‘en’))) : ?>
<div style=”float:left;margin-right:60px”><br>
medical companies</div>
<div>

 

Another useful exapmle:

if (substr($_SERVER[‘HTTP_ACCEPT_LANGUAGE’], 0, 2) == ‘en’)
{
include(‘english.htm’);
}
else
{
include(‘japanese.htm’);
}