Re: PHP on IIS



What version number were you running before? After I think it's v.4.1
the scoping of variables changed from things like...

$HTTP_POST_VARS["variable_name"] to $_POST["variable_name'].

See if $_SERVER["HTTP_USER_AGENT"] works for you.

Cheers,
D.

mwagoner@xxxxxxxxxxxxxx wrote:
I installed PHP on a IIS 5.0 sever, using the PHP installer from
php.net. Then I moved our PHP site over to the IIS server but now I am
getting the following errors:

Undefined variable: HTTP_USER_AGENT in
c:\Inetpub\wwwroot\www\browser_detection.php on line 9


here is the browser detection code (which worked fine on the server it
is currently hosted on but I need to move it to a IIS server).

<?php

// Release variables
unset ($BROWSER_AGENT);
unset ($BROWSER_VER);
unset ($BROWSER_PLATFORM);

if (ereg( 'MSIE ([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='IE';
}
elseif (ereg(
'Mozilla/([0-9].[0-9]{1,2})',$HTTP_USER_AGENT,$log_version)) {
$BROWSER_VER=$log_version[1];
$BROWSER_AGENT='NETSCAPE';
}

if (strstr($HTTP_USER_AGENT,'Win')) { $BROWSER_PLATFORM='Win'; }
else if (strstr($HTTP_USER_AGENT,'Mac')) { $BROWSER_PLATFORM='Mac'; }

//debug code
//echo ("<br>$BROWSER_PLATFORM: $BROWSER_AGENT - $BROWSER_VER");


// Disable error message when a variable is not predeclared (on
CalDrywall's IIS server)
error_reporting(E_ALL ^ E_NOTICE);

?>

thanks

.