Click to See Complete Forum and Search --> : find out navigator language code with php


cul8er23
10-19-2003, 12:52 PM
Hi all,
does anyone know how to find out the clients language code with php? us, de, ru etc.
get_browser doesn't work on my system right now because of the browsecap settings (unfortunately i dunno what that is). Are there any other functions to get client information?

I really don't whant to use Js and an additional page call (php) to add this info to my session.

Can anyone help?

Thanks in advance

cul8er23
10-19-2003, 01:47 PM
Asking for $HTTP_USER_AGENT using NAV6 gives out the following:

Mozilla/5.0 (Windows; U; Windows NT 5.0; de-DE; m18) Gecko/20001106 Netscape6/6.0

<?php
session_start();
$lang = 0;
$ua = $HTTP_USER_AGENT;

if (strchr($ua,'DE')){
$lang = 2;
}
if ( strchr($ua, 'US' ) ){
$lang = 1;
}
if (strchr($ua,'RU')){
$lang = 7;
}
session_register("lang");
?>

But still this no use if client is IE .... Grmmph