Click to See Complete Forum and Search --> : $operating_system = getenv("HTTP_USER_AGENT"); not working


cribs
12-22-2002, 07:28 PM
I want to make sure I send the right stylesheet for the OS. It works on the offsite hosting service but not on my local server. I am running Apache 2 and PHP 4.2.2 I printed out the hosting server PHP info and compaired it to mine but mine does not contained the Apache Environment section, why, and how can I add this section to my PHP.INI? If you will please also post the answer here, but send me a copy to cri@cri-business-solutions.com. The web site is http://www.ccscmh.org that I am using this php code on.

// check which operation system is being used and
// call the apporate style sheet for that system
$operating_system = getenv("HTTP_USER_AGENT");

// use the $operating_system variable to select which operating system is
// being used by the user and select which style sheet to inport
if (preg_match("/Win/i", "$operating_system")) {
$style = "./templates/stylesheet_windows.css";
$exmplmenu_var ="./templates/exmplmenu_var.js";
} else if (preg_match("/Linux/i", "$operating_system")) {
$style = "./templates/stylesheet_linux.css";
$exmplmenu_var ="./templates/exmplmenu_var_linux.js";
} // end if (preg_match("/Win/i", "$agent"))

wizkid
12-22-2002, 07:46 PM
Hi,

have a look at YABD (http://www.iezzi.ch/snippets/006_yabd.php).


wizkid

PS: I can't find an Apache Environment section on mine either.

DoD
12-23-2002, 07:07 AM
HTTP_USER_AGENT should be $HTTP_USER_AGENT

lnfreish
12-30-2002, 06:49 AM
you need use $_SERVER['HTTP_USER_AGENT'] if your PHP version is 4.2.0 or later