Reply to Re: Odd HTTP Variable Question

Your name:

Reply:


Posted by J.O. Aho on 03/18/06 10:41

No_One wrote:
> I'm confused here...maybe someone knows and can explain.
>
> I'm using a small drop in prog to manage some mysql databases at one of our
> company sites....should have been a quick job.
>
> The code, from phpMyEdit 5.4, is :
>
> $opts['language']=$HTTP_SERVER_VARS['HTTP_ACCEPT_LANGUAGE'];

Gosh, this is an old PHP script, nowadays you should be using $_SERVER instead
of $HTTP_SERVER_VARS.

> I get an error message displayed:
>
> undefined index HTTP_ACCEPT_LANGUAGE
>
> OK, now it gets strange...this only happens in Opera for Linux ver 8.52

Not all browsers do use this variable and I think you can even turn it off in
Mozilla. You should check that the variable has been set, if so then take the
value from global or else set a default value, think this code works (PHP4.1+)

if(isset($_SERVER['HTTP_ACCEPT_LANGUAGE'])) {
$opts['language']=$_SERVER['HTTP_ACCEPT_LANGUAGE'];
} else {
$opts['language']="en";
}

When it comes to Opera 8.52 for Linux x86 and Sparc (not tested on PPC as
don't have it installed on that machine), the language header is set, so it's
more likely your Opera settings where this is disabled somehow.


//Aho

[Back to original message]


Удаленная работа для программистов  •  Как заработать на Google AdSense  •  England, UK  •  статьи на английском  •  PHP MySQL CMS Apache Oscommerce  •  Online Business Knowledge Base  •  DVD MP3 AVI MP4 players codecs conversion help
Home  •  Search  •  Site Map  •  Set as Homepage  •  Add to Favourites

Copyright © 2005-2006 Powered by Custom PHP Programming

Сайт изготовлен в Студии Валентина Петручека
изготовление и поддержка веб-сайтов, разработка программного обеспечения, поисковая оптимизация